linux/net/phonet/pep.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * File: pep.c
 *
 * Phonet pipe protocol end point socket
 *
 * Copyright (C) 2008 Nokia Corporation.
 *
 * Author: Rémi Denis-Courmont
 */

#include <linux/kernel.h>
#include <linux/sched/signal.h>
#include <linux/slab.h>
#include <linux/socket.h>
#include <net/sock.h>
#include <net/tcp_states.h>
#include <asm/ioctls.h>

#include <linux/phonet.h>
#include <linux/module.h>
#include <net/phonet/phonet.h>
#include <net/phonet/pep.h>
#include <net/phonet/gprs.h>

/* sk_state values:
 * TCP_CLOSE		sock not in use yet
 * TCP_CLOSE_WAIT	disconnected pipe
 * TCP_LISTEN		listening pipe endpoint
 * TCP_SYN_RECV		connected pipe in disabled state
 * TCP_ESTABLISHED	connected pipe in enabled state
 *
 * pep_sock locking:
 *  - sk_state, hlist: sock lock needed
 *  - listener: read only
 *  - pipe_handle: read only
 */

#define CREDITS_MAX
#define CREDITS_THR

#define pep_sb_size(s)

/* Get the next TLV sub-block. */
static unsigned char *pep_get_sb(struct sk_buff *skb, u8 *ptype, u8 *plen,
					void *buf)
{}

static struct sk_buff *pep_alloc_skb(struct sock *sk, const void *payload,
					int len, gfp_t priority)
{}

static int pep_reply(struct sock *sk, struct sk_buff *oskb, u8 code,
			const void *data, int len, gfp_t priority)
{}

static int pep_indicate(struct sock *sk, u8 id, u8 code,
			const void *data, int len, gfp_t priority)
{}

#define PAD

static int pipe_handler_request(struct sock *sk, u8 id, u8 code,
				const void *data, int len)
{}

static int pipe_handler_send_created_ind(struct sock *sk)
{}

static int pep_accept_conn(struct sock *sk, struct sk_buff *skb)
{}

static int pep_reject_conn(struct sock *sk, struct sk_buff *skb, u8 code,
				gfp_t priority)
{}

/* Control requests are not sent by the pipe service and have a specific
 * message format. */
static int pep_ctrlreq_error(struct sock *sk, struct sk_buff *oskb, u8 code,
				gfp_t priority)
{}

static int pipe_snd_status(struct sock *sk, u8 type, u8 status, gfp_t priority)
{}

/* Send our RX flow control information to the sender.
 * Socket must be locked. */
static void pipe_grant_credits(struct sock *sk, gfp_t priority)
{}

static int pipe_rcv_status(struct sock *sk, struct sk_buff *skb)
{}

static int pipe_rcv_created(struct sock *sk, struct sk_buff *skb)
{}

/* Queue an skb to a connected sock.
 * Socket lock must be held. */
static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb)
{}

/* Destroy connected sock. */
static void pipe_destruct(struct sock *sk)
{}

static u8 pipe_negotiate_fc(const u8 *fcs, unsigned int n)
{}

static int pep_connresp_rcv(struct sock *sk, struct sk_buff *skb)
{}

static int pep_enableresp_rcv(struct sock *sk, struct sk_buff *skb)
{}

static void pipe_start_flow_control(struct sock *sk)
{}

/* Queue an skb to an actively connected sock.
 * Socket lock must be held. */
static int pipe_handler_do_rcv(struct sock *sk, struct sk_buff *skb)
{}

/* Listening sock must be locked */
static struct sock *pep_find_pipe(const struct hlist_head *hlist,
					const struct sockaddr_pn *dst,
					u8 pipe_handle)
{}

/*
 * Deliver an skb to a listening sock.
 * Socket lock must be held.
 * We then queue the skb to the right connected sock (if any).
 */
static int pep_do_rcv(struct sock *sk, struct sk_buff *skb)
{}

static int pipe_do_remove(struct sock *sk)
{}

/* associated socket ceases to exist */
static void pep_sock_close(struct sock *sk, long timeout)
{}

static struct sock *pep_sock_accept(struct sock *sk,
				    struct proto_accept_arg *arg)
{}

static int pep_sock_connect(struct sock *sk, struct sockaddr *addr, int len)
{}

static int pep_sock_enable(struct sock *sk, struct sockaddr *addr, int len)
{}

static unsigned int pep_first_packet_length(struct sock *sk)
{}

static int pep_ioctl(struct sock *sk, int cmd, int *karg)
{}

static int pep_init(struct sock *sk)
{}

static int pep_setsockopt(struct sock *sk, int level, int optname,
			  sockptr_t optval, unsigned int optlen)
{}

static int pep_getsockopt(struct sock *sk, int level, int optname,
				char __user *optval, int __user *optlen)
{}

static int pipe_skb_send(struct sock *sk, struct sk_buff *skb)
{}

static int pep_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
{}

int pep_writeable(struct sock *sk)
{}

int pep_write(struct sock *sk, struct sk_buff *skb)
{}

struct sk_buff *pep_read(struct sock *sk)
{}

static int pep_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
		       int flags, int *addr_len)
{}

static void pep_sock_unhash(struct sock *sk)
{}

static struct proto pep_proto =;

static const struct phonet_protocol pep_pn_proto =;

static int __init pep_register(void)
{}

static void __exit pep_unregister(void)
{}

module_init();
module_exit(pep_unregister);
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_ALIAS_NET_PF_PROTO();