linux/net/ieee802154/socket.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * IEEE802154.4 socket interface
 *
 * Copyright 2007, 2008 Siemens AG
 *
 * Written by:
 * Sergey Lapin <[email protected]>
 * Maxim Gorbachyov <[email protected]>
 */

#include <linux/net.h>
#include <linux/capability.h>
#include <linux/module.h>
#include <linux/if_arp.h>
#include <linux/if.h>
#include <linux/termios.h>	/* For TIOCOUTQ/INQ */
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/socket.h>
#include <net/datalink.h>
#include <net/psnap.h>
#include <net/sock.h>
#include <net/tcp_states.h>
#include <net/route.h>

#include <net/af_ieee802154.h>
#include <net/ieee802154_netdev.h>

/* Utility function for families */
static struct net_device*
ieee802154_get_dev(struct net *net, const struct ieee802154_addr *addr)
{}

static int ieee802154_sock_release(struct socket *sock)
{}

static int ieee802154_sock_sendmsg(struct socket *sock, struct msghdr *msg,
				   size_t len)
{}

static int ieee802154_sock_bind(struct socket *sock, struct sockaddr *uaddr,
				int addr_len)
{}

static int ieee802154_sock_connect(struct socket *sock, struct sockaddr *uaddr,
				   int addr_len, int flags)
{}

static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg,
				unsigned int cmd)
{}

static int ieee802154_sock_ioctl(struct socket *sock, unsigned int cmd,
				 unsigned long arg)
{}

/* RAW Sockets (802.15.4 created in userspace) */
static HLIST_HEAD(raw_head);
static DEFINE_RWLOCK(raw_lock);

static int raw_hash(struct sock *sk)
{}

static void raw_unhash(struct sock *sk)
{}

static void raw_close(struct sock *sk, long timeout)
{}

static int raw_bind(struct sock *sk, struct sockaddr *_uaddr, int len)
{}

static int raw_connect(struct sock *sk, struct sockaddr *uaddr,
		       int addr_len)
{}

static int raw_disconnect(struct sock *sk, int flags)
{}

static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
{}

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

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

static void ieee802154_raw_deliver(struct net_device *dev, struct sk_buff *skb)
{}

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

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

static struct proto ieee802154_raw_prot =;

static const struct proto_ops ieee802154_raw_ops =;

/* DGRAM Sockets (802.15.4 dataframes) */
static HLIST_HEAD(dgram_head);
static DEFINE_RWLOCK(dgram_lock);

struct dgram_sock {};

static inline struct dgram_sock *dgram_sk(const struct sock *sk)
{}

static int dgram_hash(struct sock *sk)
{}

static void dgram_unhash(struct sock *sk)
{}

static int dgram_init(struct sock *sk)
{}

static void dgram_close(struct sock *sk, long timeout)
{}

static int dgram_bind(struct sock *sk, struct sockaddr *uaddr, int len)
{}

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

/* FIXME: autobind */
static int dgram_connect(struct sock *sk, struct sockaddr *uaddr,
			 int len)
{}

static int dgram_disconnect(struct sock *sk, int flags)
{}

static int dgram_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
{}

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

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

static inline bool
ieee802154_match_sock(__le64 hw_addr, __le16 pan_id, __le16 short_addr,
		      struct dgram_sock *ro)
{}

static int ieee802154_dgram_deliver(struct net_device *dev, struct sk_buff *skb)
{}

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

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

static struct proto ieee802154_dgram_prot =;

static const struct proto_ops ieee802154_dgram_ops =;

static void ieee802154_sock_destruct(struct sock *sk)
{}

/* Create a socket. Initialise the socket, blank the addresses
 * set the state.
 */
static int ieee802154_create(struct net *net, struct socket *sock,
			     int protocol, int kern)
{}

static const struct net_proto_family ieee802154_family_ops =;

static int ieee802154_rcv(struct sk_buff *skb, struct net_device *dev,
			  struct packet_type *pt, struct net_device *orig_dev)
{}

static struct packet_type ieee802154_packet_type =;

static int __init af_ieee802154_init(void)
{}

static void __exit af_ieee802154_remove(void)
{}

module_init();
module_exit(af_ieee802154_remove);

MODULE_LICENSE();
MODULE_DESCRIPTION();
MODULE_ALIAS_NETPROTO();