Chapter 12: Networks
All transport protocols of the kernel are grouped into the arraystatic struct net_proto_family
*net_families[NPROTO]defined innet/socket.c. (ccodesock_register is used to add new entries to
the database.) The individual members provide a protocol-specific initialization function.
<net.h>
struct net_proto_family {
int family;
int (*create)(struct socket *sock, int protocol);
struct module *owner;
};
Table 12-3: Network-Related System Calls for Whichsys_socketcallActs as a Multi-
plexer
Function Meaning
sys_socket Creates a new socket.
sys_bind Binds an address to a socket.
sys_connect Connects a socket with a server.
sys_listen Opens a passive connection to listen on the socket.
sys_accept Accepts an incoming connection request.
sys_getsockname Returns the address of the socket.
sys_getpeername Returns the address of the communication partner.
sys_socketpair Creates a socket pair that can be used immediately for bidirectional communi-
cation (both sockets are on the same system).
sys_send Sends data via an existing connection.
sys_sendto Sends data to an explicitly specified destination address (for UDP connections).
sys_recv Receives data.
sys_recvfrom Receives data from a datagram socket and returns the source address at the
same time.
sys_shutdown Closes the connection.
sys_setsockopt Returns information on the socket settings.
sys_getsockopt Sets socket options.
sys_sendmsg Sends messages in BSD style.
sys_recvmsg Receives messages in BSD style.