Download presentation
Presentation is loading. Please wait.
Published byBudi Rachman Modified over 6 years ago
1
Linux Networks TCP/IP Networking Layers BSD Socket Interface
INET Socket Layer Create Bind Listen Accept Connect
2
Linux Networking Layers
Network Applications User Kernel BSD Sockets Socket Interface INET Sockets TCP UDP Protocol Layers IP ARP Network Devices PPP SLIP Ethernet Linux Networking Layers
3
Linux BSD Socket Data Structure
files_struct count close_on_exec open_fs fd[0] fd[1] fd[255] BSD Socket File Operations file f_mode f_pos f_flags f_count f_owner f_op f_inode f_version lseek read write select ioctl close fasync inode socket SOCK_STREAM type protocol data Address Family socket operations SOCK_STREAM sock type protocol socket Linux BSD Socket Data Structure
4
System Call <net/socket.c>
int sys_socketcall(int call, unsigned long *args); call <linux/net.h> SYS_SOCKET --> socket() SYS_BIND > bind() args args[]
5
family <include/linux/socket.h> AF_UNIX AF_INET AF_IPX
Unix domain sockets AF_INET Internet IP Protocol AF_IPX Novell IPX AF_APPLETALK Appletalk DDP AF_X25 Reserved for X.25 project
6
type <include/linux/socket.h> SOCK_STREAM SOCK_DGRAM SOCK_RAW
stream (connection) socket SOCK_DGRAM datagram (conn.less) socket SOCK_RAW raw socket SOCK_RDM reliably-delivered message SOCK_SEQPACKET sequential packet socket
7
protocol <include/linux/in.h> IPPROTO_IP IPPROTO_ICMP
Dummy protocol for TCP IPPROTO_ICMP Internet Control Message Protocol IPPROTO_IGMP Internet Group Management Protocol IPPROTO_TCP Transmission Control Protocol IPPROTO_EGP Exterior Gateway Protocol
8
socket(family, type, protocol)
<net/socket.c> sys_socket(...) get an empty inode for socket structure allocate a sock structure return the file descriptor of the socket if success
9
bind(fd, uaddr, addrlen)
<net/socket.c> sys_bind(...) bind a name to a socket move the socket address to kernel space address & port checking
10
listen(fd, backlog) <net/socket.c> sys_listen(...)
allow the protocol to do anything necessary move a socket into listening state
11
accept(fd, sockaddr, skaddrlen)
<net/socket.c> sys_accept(...) attempt to create a new socket set up the link with the client wake up the client return the new fd
12
connect(fd, uaddr, addrlen)
<net/socket.c> sys_connect(...) attempt to connect to a socket with the server address move the address to kernel space
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.