#include <linux/stringify.h>
#include <linux/random.h>
#include <linux/wait.h>
#include <linux/fcntl.h>
#include <linux/kmemcheck.h>
#include <linux/rcupdate.h>
#include <uapi/linux/net.h>
Go to the source code of this file.
|
#define | SOCK_ASYNC_NOSPACE 0 |
|
#define | SOCK_ASYNC_WAITDATA 1 |
|
#define | SOCK_NOSPACE 2 |
|
#define | SOCK_PASSCRED 3 |
|
#define | SOCK_PASSSEC 4 |
|
#define | SOCK_EXTERNALLY_ALLOCATED 5 |
|
#define | SOCK_MAX (SOCK_PACKET + 1) |
|
#define | SOCK_TYPE_MASK 0xf |
|
#define | SOCK_CLOEXEC O_CLOEXEC |
|
#define | SOCK_NONBLOCK O_NONBLOCK |
|
#define | DECLARE_SOCKADDR(type, dst, src) type dst = ({ __sockaddr_check_size(sizeof(*dst)); (type) src; }) |
|
#define | sockfd_put(sock) fput(sock->file) |
|
#define | net_ratelimited_function(function,...) |
|
#define | net_emerg_ratelimited(fmt,...) net_ratelimited_function(pr_emerg, fmt, ##__VA_ARGS__) |
|
#define | net_alert_ratelimited(fmt,...) net_ratelimited_function(pr_alert, fmt, ##__VA_ARGS__) |
|
#define | net_crit_ratelimited(fmt,...) net_ratelimited_function(pr_crit, fmt, ##__VA_ARGS__) |
|
#define | net_err_ratelimited(fmt,...) net_ratelimited_function(pr_err, fmt, ##__VA_ARGS__) |
|
#define | net_notice_ratelimited(fmt,...) net_ratelimited_function(pr_notice, fmt, ##__VA_ARGS__) |
|
#define | net_warn_ratelimited(fmt,...) net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__) |
|
#define | net_info_ratelimited(fmt,...) net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__) |
|
#define | net_dbg_ratelimited(fmt,...) net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__) |
|
#define | net_random() random32() |
|
#define | net_srandom(seed) srandom32((__force u32)seed) |
|
#define | MODULE_ALIAS_NETPROTO(proto) MODULE_ALIAS("net-pf-" __stringify(proto)) |
|
#define | MODULE_ALIAS_NET_PF_PROTO(pf, proto) MODULE_ALIAS("net-pf-" __stringify(pf) "-proto-" __stringify(proto)) |
|
#define | MODULE_ALIAS_NET_PF_PROTO_TYPE(pf, proto, type) |
|
#define | MODULE_ALIAS_NET_PF_PROTO_NAME(pf, proto, name) |
|
|
enum | sock_type {
SOCK_DGRAM = 1,
SOCK_STREAM = 2,
SOCK_RAW = 3,
SOCK_RDM = 4,
SOCK_SEQPACKET = 5,
SOCK_DCCP = 6,
SOCK_PACKET = 10,
SOCK_STREAM = 1,
SOCK_DGRAM = 2,
SOCK_RAW = 3,
SOCK_RDM = 4,
SOCK_SEQPACKET = 5,
SOCK_DCCP = 6,
SOCK_PACKET = 10
} |
|
enum | sock_shutdown_cmd { SHUT_RD = 0,
SHUT_WR = 1,
SHUT_RDWR = 2
} |
|
enum | { SOCK_WAKE_IO,
SOCK_WAKE_WAITD,
SOCK_WAKE_SPACE,
SOCK_WAKE_URG
} |
|
|
int | sock_wake_async (struct socket *sk, int how, int band) |
|
int | sock_register (const struct net_proto_family *fam) |
|
void | sock_unregister (int family) |
|
int | __sock_create (struct net *net, int family, int type, int proto, struct socket **res, int kern) |
|
int | sock_create (int family, int type, int proto, struct socket **res) |
|
int | sock_create_kern (int family, int type, int proto, struct socket **res) |
|
int | sock_create_lite (int family, int type, int proto, struct socket **res) |
|
void | sock_release (struct socket *sock) |
|
int | sock_sendmsg (struct socket *sock, struct msghdr *msg, size_t len) |
|
int | sock_recvmsg (struct socket *sock, struct msghdr *msg, size_t size, int flags) |
|
struct file * | sock_alloc_file (struct socket *sock, int flags, const char *dname) |
|
struct socket * | sockfd_lookup (int fd, int *err) |
|
struct socket * | sock_from_file (struct file *file, int *err) |
|
int | net_ratelimit (void) |
|
int | kernel_sendmsg (struct socket *sock, struct msghdr *msg, struct kvec *vec, size_t num, size_t len) |
|
int | kernel_recvmsg (struct socket *sock, struct msghdr *msg, struct kvec *vec, size_t num, size_t len, int flags) |
|
int | kernel_bind (struct socket *sock, struct sockaddr *addr, int addrlen) |
|
int | kernel_listen (struct socket *sock, int backlog) |
|
int | kernel_accept (struct socket *sock, struct socket **newsock, int flags) |
|
int | kernel_connect (struct socket *sock, struct sockaddr *addr, int addrlen, int flags) |
|
int | kernel_getsockname (struct socket *sock, struct sockaddr *addr, int *addrlen) |
|
int | kernel_getpeername (struct socket *sock, struct sockaddr *addr, int *addrlen) |
|
int | kernel_getsockopt (struct socket *sock, int level, int optname, char *optval, int *optlen) |
|
int | kernel_setsockopt (struct socket *sock, int level, int optname, char *optval, unsigned int optlen) |
|
int | kernel_sendpage (struct socket *sock, struct page *page, int offset, size_t size, int flags) |
|
int | kernel_sock_ioctl (struct socket *sock, int cmd, unsigned long arg) |
|
int | kernel_sock_shutdown (struct socket *sock, enum sock_shutdown_cmd how) |
|
#define MODULE_ALIAS_NET_PF_PROTO_NAME |
( |
|
pf, |
|
|
|
proto, |
|
|
|
name |
|
) |
| |
Value:
Definition at line 283 of file net.h.
#define MODULE_ALIAS_NET_PF_PROTO_TYPE |
( |
|
pf, |
|
|
|
proto, |
|
|
|
type |
|
) |
| |
Value:
Definition at line 279 of file net.h.
#define net_ratelimited_function |
( |
|
function, |
|
|
|
... |
|
) |
| |
Value:do { \
function(__VA_ARGS__); \
} while (0)
Definition at line 220 of file net.h.
#define SOCK_ASYNC_NOSPACE 0 |
Definition at line 35 of file net.h.
#define SOCK_ASYNC_WAITDATA 1 |
Definition at line 36 of file net.h.
Definition at line 74 of file net.h.
#define SOCK_EXTERNALLY_ALLOCATED 5 |
Definition at line 40 of file net.h.
Definition at line 68 of file net.h.
Definition at line 76 of file net.h.
Definition at line 37 of file net.h.
Definition at line 38 of file net.h.
Definition at line 39 of file net.h.
#define SOCK_TYPE_MASK 0xf |
Definition at line 71 of file net.h.
- Enumerator:
SOCK_WAKE_IO |
|
SOCK_WAKE_WAITD |
|
SOCK_WAKE_SPACE |
|
SOCK_WAKE_URG |
|
Definition at line 191 of file net.h.
- Enumerator:
SHUT_RD |
|
SHUT_WR |
|
SHUT_RDWR |
|
Definition at line 81 of file net.h.
enum sock_type - Socket types : stream (connection) socket : datagram (conn.less) socket : raw socket : reliably-delivered message : sequential packet socket : Datagram Congestion Control Protocol socket : linux specific way of getting packets at the dev level. For writing rarp and other similar things on the user level.
When adding some new socket type please grep ARCH_HAS_SOCKET_TYPE include/asm-* /socket.h, at least MIPS overrides this enum for binary compat reasons.
- Enumerator:
SOCK_DGRAM |
|
SOCK_STREAM |
|
SOCK_RAW |
|
SOCK_RDM |
|
SOCK_SEQPACKET |
|
SOCK_DCCP |
|
SOCK_PACKET |
|
SOCK_STREAM |
|
SOCK_DGRAM |
|
SOCK_RAW |
|
SOCK_RDM |
|
SOCK_SEQPACKET |
|
SOCK_DCCP |
|
SOCK_PACKET |
|
Definition at line 58 of file net.h.
kernel_recvmsg - Receive a message from a socket (kernel space) : The socket to receive the message from : Received message : Input s/g array for message data : Size of input s/g array : Number of bytes to read : Message flags (MSG_DONTWAIT, etc...)
On return the msg structure contains the scatter/gather array passed in the vec argument. The array is modified so that it consists of the unfilled portion of the original array.
The returned value is the total number of bytes received, or an error.
Definition at line 852 of file socket.c.
sock_register - add a socket protocol handler : description of protocol
This function is called by a protocol handler that wants to advertise its address family, and have it linked into the socket interface. The value ops->family coresponds to the socket system call protocol family.
Definition at line 2557 of file socket.c.
sock_release - close a socket : socket to close
The socket is released from the protocol stack if it has a release callback, and the inode is then released if the socket is bound to an inode not a file.
Definition at line 580 of file socket.c.
sock_unregister - remove a protocol handler : protocol family to remove
This function is called by a protocol handler that wants to remove its address family, and have it unlinked from the new socket creation.
If protocol handler is a module, then it can use module reference counts to protect against new references. If protocol handler is not a module then it needs to provide its own protection in the ops->create routine.
Definition at line 2595 of file socket.c.
sockfd_lookup - Go from a file number to its socket slot : file handle : pointer to an error code return
The file handle passed in is locked and the socket it is bound too is returned. If an error occurs the err pointer is overwritten with a negative errno code and NULL is returned. The function checks for both invalid handles and passing a handle which is not a socket.
On a success the socket object pointer is returned.
Definition at line 428 of file socket.c.