Internet Protocol (IP) Service
[Inter-networking layer]

Collaboration diagram for Internet Protocol (IP) Service:

Data Structures

struct  ip_netif
 IP network interfaces. More...
struct  ip_proto
 IP protocol specific data. More...
struct  ip_route
 IP route specific data. More...
struct  ip_globals
 IP global data. More...
struct  ip_header
 Internet header. More...
struct  ip_option
 Internet option header. More...
struct  ipv4_pseudo_header
 Internet version 4 pseudo header. More...

Files

file  ip.c
 

IP module implementation.


file  ip.h
 

IP module.


file  ip_client.c
 

IP client interface implementation.


file  ip_header.h
 

IP header and options definitions.


file  ip_messages.h
 

IP module messages.


file  ip_module.c
 

IP standalone module implementation.


file  ip_module.h
 

IP module functions.


file  ip_remote.c
 

IP interface implementation for standalone remote modules.


file  ip_client.h
 

IP client interface.


file  ip_codes.h
 

IP codes and definitions.


file  ip_interface.h
 

IP module interface.


file  ip_protocols.h
 

Internet protocol numbers according to the on-line IANA - Assigned Protocol numbers - <http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml>, cited January 14 2009.


Defines

#define IPV4   4
 IP version 4.
#define NET_DEFAULT_IPV   IPV4
 Default network interface IP version.
#define NET_DEFAULT_IP_ROUTING   false
 Default network interface IP routing.
#define IP_MIN_CONTENT   576
 Minimum IP packet content.
#define ARP_NAME   "arp"
 ARP module name.
#define ARP_FILENAME   "/srv/arp"
 ARP module filename.
#define IP_ADDR   sizeof(struct sockaddr_in6)
 IP packet address length.
#define IP_PREFIX   sizeof(ip_header_t)
 IP packet prefix length.
#define IP_SUFFIX   0
 IP packet suffix length.
#define IP_MAX_CONTENT   65535
 IP packet maximum content length.
#define IPV4_LOCALHOST_ADDRESS   htonl((127 << 24) + 1)
 The IP localhost address.
#define IP_COMPUTE_FRAGMENT_OFFSET_HIGH(length)   ((((length) / 8u) &0x1F00) >> 8)
 Returns the fragment offest high bits.
#define IP_COMPUTE_FRAGMENT_OFFSET_LOW(length)   (((length) / 8u) &0xFF)
 Returns the fragment offest low bits.
#define IP_COMPUTE_HEADER_LENGTH(length)   ((uint8_t) ((length) / 4u))
 Returns the IP header length.
#define IP_FRAGMENT_OFFSET(header)   ((((header)->fragment_offset_high << 8) + (header)->fragment_offset_low) * 8u)
 Returns the fragment offest.
#define IP_HEADER_CHECKSUM(header)   (htons(ip_checksum((uint8_t *)(header), IP_HEADER_LENGTH(header))))
 Returns the IP packet header checksum.
#define IP_HEADER_DATA_LENGTH(header)   (IP_TOTAL_LENGTH(header) - IP_HEADER_LENGTH(header))
 Returns the actual IP packet data length.
#define IP_HEADER_LENGTH(header)   ((header)->header_length * 4u)
 Returns the actual IP header length in bytes.
#define IP_TOTAL_LENGTH(header)   ntohs((header)->total_length)
 Returns the actual IP packet total length.
#define NAME   "IP protocol"
 IP module name.
#define IPVERSION   4
 Default IPVERSION.
#define MAXTTL   255
 Maximum time to live counter.
#define IPDEFTTL   64
 Default time to live counter.

Typedefs

typedef struct ip_globals ip_globals_t
 Type definition of the IP global data.
typedef struct ip_netif ip_netif_t
 Type definition of the IP network interface specific data.
typedef ip_netif_tip_netif_ref
 Type definition of the IP network interface specific data pointer.
typedef struct ip_proto ip_proto_t
 Type definition of the IP protocol specific data.
typedef ip_proto_tip_proto_ref
 Type definition of the IP protocol specific data pointer.
typedef struct ip_route ip_route_t
 Type definition of the IP route specific data.
typedef ip_route_tip_route_ref
 Type definition of the IP route specific data pointer.
typedef struct ip_header ip_header_t
 Type definition of the internet header.
typedef ip_header_tip_header_ref
 Type definition of the internet header pointer.
typedef struct ip_option ip_option_t
 Type definition of the internet option header.
typedef ip_option_tip_option_ref
 Type definition of the internet option header pointer.
typedef struct ipv4_pseudo_header ipv4_pseudo_header_t
 Type definition of the internet version 4 pseudo header.
typedef ipv4_pseudo_header_tipv4_pseudo_header_ref
 Type definition of the internet version 4 pseudo header pointer.
typedef uint8_t ip_ttl_t
 IP time to live counter type definition.
typedef uint8_t ip_tos_t
 IP type of service type definition.
typedef uint8_t ip_protocol_t
 IP transport protocol type definition.

Enumerations

enum  ip_messages { NET_IP_ADD_ROUTE = NET_IP_FIRST, NET_IP_GET_ROUTE, NET_IP_RECEIVED_ERROR, NET_IP_SET_GATEWAY }
 

IP module messages.

More...

Functions

int ip_mtu_changed_message (device_id_t device_id, size_t mtu)
 Updates the device content length according to the new MTU value.
int ip_device_state_message (device_id_t device_id, device_state_t state)
 Updates the device state.
int ip_packet_size_message (device_id_t device_id, size_t *addr_len, size_t *prefix, size_t *content, size_t *suffix)
 Returns the device packet dimensions for sending.
int ip_register (int protocol, services_t service, int phone, tl_received_msg_t tl_received_msg)
 Registers the transport layer protocol.
int ip_netif_initialize (ip_netif_ref ip_netif)
 Initializes a new network interface specific data.
int ip_send_route (packet_t packet, ip_netif_ref netif, ip_route_ref route, in_addr_t *src, in_addr_t dest, services_t error)
 Sends the packet or the packet queue via the specified route.
int ip_prepare_packet (in_addr_t *source, in_addr_t dest, packet_t packet, measured_string_ref destination)
 Prepares the outgoing packet or the packet queue.
packet_t ip_split_packet (packet_t packet, size_t prefix, size_t content, size_t suffix, socklen_t addr_len, services_t error)
 Checks the packet queue lengths and fragments the packets if needed.
int ip_fragment_packet (packet_t packet, size_t length, size_t prefix, size_t suffix, socklen_t addr_len)
 Checks the packet length and fragments it if needed.
int ip_fragment_packet_data (packet_t packet, packet_t new_packet, ip_header_ref header, ip_header_ref new_header, size_t length, const struct sockaddr *src, const struct sockaddr *dest, socklen_t addrlen)
 Fragments the packet from the end.
ip_header_ref ip_create_middle_header (packet_t packet, ip_header_ref last)
 Prefixes a middle fragment header based on the last fragment header to the packet.
void ip_create_last_header (ip_header_ref last, ip_header_ref first)
 Copies the fragment header.
in_addr_tip_netif_address (ip_netif_ref netif)
 Returns the network interface's IP address.
ip_route_ref ip_find_route (in_addr_t destination)
 Searches all network interfaces if there is a suitable route.
ip_route_ref ip_netif_find_route (ip_netif_ref netif, in_addr_t destination)
 Searches the network interfaces if there is a suitable route.
int ip_receive_message (device_id_t device_id, packet_t packet)
 Processes the received IP packet or the packet queue one by one.
int ip_process_packet (device_id_t device_id, packet_t packet)
 Processes the received packet.
in_addr_t ip_get_destination (ip_header_ref header)
 Returns the packet destination address from the IP header.
int ip_deliver_local (device_id_t device_id, packet_t packet, ip_header_ref header, services_t error)
 Delivers the packet to the local host.
int ip_prepare_icmp_and_get_phone (services_t error, packet_t packet, ip_header_ref header)
 Prepares the ICMP notification packet.
int ip_get_icmp_phone (void)
 Returns the ICMP phone.
int ip_prepare_icmp (packet_t packet, ip_header_ref header)
 Prepares the ICMP notification packet.
int ip_release_and_return (packet_t packet, int result)
 Releases the packet and returns the result.
int ip_initialize (async_client_conn_t client_connection)
 Initializes the IP module.
int ip_message (ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, int *answer_count)
 Processes the IP message.
size_t ip_client_header_length (packet_t packet)
 Returns the IP header length.
int ip_client_get_pseudo_header (ip_protocol_t protocol, struct sockaddr *src, socklen_t srclen, struct sockaddr *dest, socklen_t destlen, size_t data_length, ip_pseudo_header_ref *header, size_t *headerlen)
 Constructs the IPv4 pseudo header.
int ip_client_prepare_packet (packet_t packet, ip_protocol_t protocol, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, size_t ipopt_length)
 Prepares the packet to be transfered via IP.
int ip_client_process_packet (packet_t packet, ip_protocol_t *protocol, ip_ttl_t *ttl, ip_tos_t *tos, int *dont_fragment, size_t *ipopt_length)
 Processes the received IP packet.
int ip_client_set_pseudo_header_data_length (ip_pseudo_header_ref header, size_t headerlen, size_t data_length)
 Updates the IPv4 pseudo header data length field.
int module_message (ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, int *answer_count)
 Processes the IP message.
void module_print_name (void)
 Prints the module name.
int module_start (async_client_conn_t client_connection)
 Starts the IP module.

Variables

ip_globals_t ip_globals
 IP global data.
ip_globals_t ip_globals
 IP module global data.

IP module interface

This interface is used by other modules.



typedef void * ip_pseudo_header_ref
 Type definition of the internet pseudo header pointer.
typedef int(* tl_received_msg_t )(device_id_t device_id, packet_t packet, services_t receiver, services_t error)
 The transport layer notification function type definition.
int ip_device_req (int ip_phone, device_id_t device_id, services_t netif)
 Registers the new device.
int ip_connect_module (services_t service)
 Connects to the IP module.
int ip_bind_service (services_t service, int protocol, services_t me, async_client_conn_t receiver, tl_received_msg_t tl_received_msg)
 Creates bidirectional connection with the ip module service and registers the message receiver.
int ip_send_msg (int ip_phone, device_id_t device_id, packet_t packet, services_t sender, services_t error)
 Sends the packet queue.
int ip_packet_size_req (int ip_phone, device_id_t device_id, packet_dimension_ref packet_dimension)
 Returns the device packet dimension for sending.
int ip_add_route_req (int ip_phone, device_id_t device_id, in_addr_t address, in_addr_t netmask, in_addr_t gateway)
 Adds a route to the device routing table.
int ip_set_gateway_req (int ip_phone, device_id_t device_id, in_addr_t gateway)
 Sets the default gateway.
int ip_received_error_msg (int ip_phone, device_id_t device_id, packet_t packet, services_t target, services_t error)
 Notifies the IP module about the received error notification packet.
int ip_get_route_req (int ip_phone, ip_protocol_t protocol, const struct sockaddr *destination, socklen_t addrlen, device_id_t *device_id, ip_pseudo_header_ref *header, size_t *headerlen)
 Returns the device identifier and the IP pseudo header based on the destination address.

IP flags definitions



#define IPFLAG_FRAGMENT_SHIFT   1
 Fragment flag field shift.
#define IPFLAG_FRAGMENTED_SHIFT   0
 Fragmented flag field shift.
#define IPFLAG_DONT_FRAGMENT   (0x1 << IPFLAG_FRAGMENT_SHIFT)
 Don't fragment flag value.
#define IPFLAG_LAST_FRAGMENT   (0x0 << IPFLAG_FRAGMENTED_SHIFT)
 Last fragment flag value.
#define IPFLAG_MAY_FRAGMENT   (0x0 << IPFLAG_FRAGMENT_SHIFT)
 May fragment flag value.
#define IPFLAG_MORE_FRAGMENTS   (0x1 << IPFLAG_FRAGMENTED_SHIFT)
 More fragments flag value.

IP specific message parameters definitions



#define IP_GET_ADDRESS(call)   ({in_addr_t addr; addr.s_addr = IPC_GET_ARG3(*call); addr;})
 Returns the address message parameter.
#define IP_GET_GATEWAY(call)   ({in_addr_t addr; addr.s_addr = IPC_GET_ARG2(*call); addr;})
 Returns the gateway message parameter.
#define IP_SET_HEADERLEN(answer)   ((size_t *) &IPC_GET_ARG2(*answer))
 Sets the header length in the message answer.
#define IP_GET_NETMASK(call)   ({in_addr_t addr; addr.s_addr = IPC_GET_ARG4(*call); addr;})
 Returns the network mask message parameter.
#define IP_GET_PROTOCOL(call)   ((ip_protocol_t) IPC_GET_ARG1(*call))
 Returns the protocol message parameter.

IP type of service definitions



#define IPTOS_TOS_MASK   0x1E
 IP TOS mask.
#define IPTOS_PRECEDENCE_SHIFT   5
 Precedence shift.
#define IPTOS_DELAY_SHIFT   4
 Delay shift.
#define IPTOS_THROUGHPUT_SHIFT   3
 Throughput shift.
#define IPTOS_RELIABILITY_SHIFT   2
 Reliability shift.
#define IPTOS_COST_SHIFT   1
 Cost shift.
#define IPTOS_NORMALDELAY   (0x0 << IPTOS_DELAY_SHIFT)
 Normal delay.
#define IPTOS_LOWDELAY   (0x1 << IPTOS_DELAY_SHIFT)
 Low delay.
#define IPTOS_NORMALTHROUGHPUT   (0x0 << IPTOS_THROUGHPUT_SHIFT)
 Normal throughput.
#define IPTOS_THROUGHPUT   (0x1 << IPTOS_THROUGHPUT_SHIFT)
 Throughput.
#define IPTOS_NORMALRELIABILITY   (0x0 << IPTOS_RELIABILITY_SHIFT)
 Normal reliability.
#define IPTOS_RELIABILITY   (0x1 << IPTOS_RELIABILITY_SHIFT)
 Reliability.
#define IPTOS_NORMALCOST   (0x0 << IPTOS_COST_SHIFT)
 Normal cost.
#define IPTOS_MICNCOST   (0x1 << IPTOS_COST_SHIFT)
 Minimum cost.

IP TOS precedence definitions



#define IPTOS_PREC_MASK   0xE0
 Precedence mask.
#define IPTOS_PREC_ROUTINE   (0x0 << IPTOS_PRECEDENCE_SHIFT)
 Routine precedence.
#define IPTOS_PREC_PRIORITY   (0x1 << IPTOS_PRECEDENCE_SHIFT)
 Priority precedence.
#define IPTOS_PREC_IMMEDIATE   (0x2 << IPTOS_PRECEDENCE_SHIFT)
 Immediate precedence.
#define IPTOS_PREC_FLASH   (0x3 << IPTOS_PRECEDENCE_SHIFT)
 Flash precedence.
#define IPTOS_PREC_FLASHOVERRIDE   (0x4 << IPTOS_PRECEDENCE_SHIFT)
 Flash override precedence.
#define IPTOS_PREC_CRITIC_ECP   (0x5 << IPTOS_PRECEDENCE_SHIFT)
 Critical precedence.
#define IPTOS_PREC_INTERNETCONTROL   (0x6 << IPTOS_PRECEDENCE_SHIFT)
 Inter-network control precedence.
#define IPTOS_PREC_NETCONTROL   (0x7 << IPTOS_PRECEDENCE_SHIFT)
 Network control precedence.

IP options definitions



#define IPOPT_COPY_SHIFT   7
 Copy shift.
#define IPOPT_CLASS_SHIFT   5
 Class shift.
#define IPOPT_NUMBER_SHIFT   0
 Number shift.
#define IPOPT_CLASS_MASK   0x60
 Class mask.
#define IPOPT_NUMBER_MASK   0x1F
 Number mask.
#define IPOPT_COPY   (1 << IPOPT_COPY_SHIFT)
 Copy flag.
#define IPOPT_TYPE(copy, class, number)   (((copy) &IPOPT_COPY) | ((class) &IPOPT_CLASS_MASK) | ((number << IPOPT_NUMBER_SHIFT) &IPOPT_NUMBER_MASK))
 Returns IP option type.
#define IPOPT_COPIED(o)   ((o) &IPOPT_COPY)
 Returns a value indicating whether the IP option should be copied.
#define IPOPT_CLASS(o)   ((o) &IPOPT_CLASS_MASK)
 Returns an IP option class.
#define IPOPT_NUMBER(o)   ((o) &IPOPT_NUMBER_MASK)
 Returns an IP option number.

IP option class definitions



#define IPOPT_CONTROL   (0 << IPOPT_CLASS_SHIFT)
 Control class.
#define IPOPT_RESERVED1   (1 << IPOPT_CLASS_SHIFT)
 Reserved class 1.
#define IPOPT_MEASUREMENT   (2 << IPOPT_CLASS_SHIFT)
 Measurement class.
#define IPOPT_RESERVED2   (3 << IPOPT_CLASS_SHIFT)
 Reserved class 2.

IP option type definitions



#define IPOPT_END   IPOPT_TYPE(0, IPOPT_CONTROL, 0)
 End of list.
#define IPOPT_NOOP   IPOPT_TYPE(0, IPOPT_CONTROL, 1)
 No operation.
#define IPOPT_SEC   IPOPT_TYPE(IPOPT_COPY, IPOPT_CONTROL, 2)
 Security.
#define IPOPT_LSRR   IPOPT_TYPE(IPOPT_COPY, IPOPT_CONTROL, 3)
 Loose source.
#define IPOPT_SSRR   IPOPT_TYPE(IPOPT_COPY, IPOPT_CONTROL, 9)
 Strict route.
#define IPOPT_RR   IPOPT_TYPE(IPOPT_COPY, IPOPT_CONTROL, 7)
 Record route.
#define IPOPT_SID   IPOPT_TYPE(IPOPT_COPY, IPOPT_CONTROL, 8)
 Stream identifier.
#define IPOPT_SID_LENGTH   4
 Stream identifier length.
#define IPOPT_TIMESTAMP   IPOPT_TYPE(IPOPT_COPY, IPOPT_MEASUREMENT, 4)
 Internet timestamp.
#define IPOPT_CIPSO   IPOPT_TYPE(IPOPT_COPY, IPOPT_CONTROL, 5)
 Commercial IP security option.
#define IPOPT_NOP   IPOPT_NOOP
 No operation variant.
#define IPOPT_EOL   IPOPT_END
 End of list variant.
#define IPOPT_TS   IPOPT_TIMESTAMP
 Timestamp variant.

IP security option definitions



#define IPOPT_SEC_LENGTH   11
 Security length.
#define IPOPT_SEC_UNCLASIFIED   0x0
 Unclasified.
#define IPOPT_SEC_CONFIDENTIAL   0xF035
 Confidential.
#define IPOPT_SEC_EFTO   0x789A
 EFTO.
#define IPOPT_SEC_MMMM   0xBC4D
 MMMM.
#define IPOPT_SEC_PROG   0x5E26
 PROG.
#define IPOPT_SEC_RESTRICTED   0xAF13
 Restricted.
#define IPOPT_SEC_SECRET   0xD788
 Secret.
#define IPOPT_SEC_TOP_SECRET   0x6BC5
 Top secret.

IP timestamp option definitions



#define IPOPT_TS_TSONLY   0
 Tiemstamp only.
#define IPOPT_TS_TSANDADDR   1
 Timestamps and addresses.
#define IPOPT_TS_PRESPEC   3
 Specified modules only.

IP protocols definitions



#define IPPROTO_HOPOPT   0
 IPv6 Hop-by-Hop Option internet protocol number.
#define IPPROTO_ICMP   1
 Internet Control Message internet protocol number.
#define IPPROTO_IGMP   2
 Internet Group Management internet protocol number.
#define IPPROTO_GGP   3
 Gateway-to-Gateway internet protocol number.
#define IPPROTO_IP   4
 IP in IP (encapsulation) internet protocol number.
#define IPPROTO_ST   5
 Stream internet protocol number.
#define IPPROTO_TCP   6
 Transmission Control internet protocol number.
#define IPPROTO_CBT   7
 CBT internet protocol number.
#define IPPROTO_EGP   8
 Exterior Gateway Protocol internet protocol number.
#define IPPROTO_IGP   9
 any private interior gateway (used by Cisco for their IGRP) internet protocol number.
#define IPPROTO_BBN_RCC_MON   10
 BBN RCC Monitoring internet protocol number.
#define IPPROTO_NVP_II   11
 Network Voice Protocol internet protocol number.
#define IPPROTO_PUP   12
 PUP internet protocol number.
#define IPPROTO_ARGUS   13
 ARGUS internet protocol number.
#define IPPROTO_EMCON   14
 EMCON internet protocol number.
#define IPPROTO_XNET   15
 Cross Net Debugger internet protocol number.
#define IPPROTO_CHAOS   16
 Chaos internet protocol number.
#define IPPROTO_UDP   17
 User Datagram internet protocol number.
#define IPPROTO_MUX   18
 Multiplexing internet protocol number.
#define IPPROTO_DCN_MEAS   19
 DCN Measurement Subsystems internet protocol number.
#define IPPROTO_HMP   20
 Host Monitoring internet protocol number.
#define IPPROTO_PRM   21
 Packet Radio Measurement internet protocol number.
#define IPPROTO_XNS_IDP   22
 XEROX NS IDP internet protocol number.
#define IPPROTO_TRUNK_1   23
 Trunk-1 internet protocol number.
#define IPPROTO_TRUNK_2   24
 Trunk-2 internet protocol number.
#define IPPROTO_LEAF_1   25
 Leaf-1 internet protocol number.
#define IPPROTO_LEAF_2   26
 Leaf-2 internet protocol number.
#define IPPROTO_RDP   27
 Reliable Data Protocol internet protocol number.
#define IPPROTO_IRTP   28
 Internet Reliable Transaction internet protocol number.
#define IPPROTO_ISO_TP4   29
 ISO Transport Protocol Class 4 internet protocol number.
#define IPPROTO_NETBLT   30
 Bulk Data Transfer Protocol internet protocol number.
#define IPPROTO_MFE_NSP   31
 MFE Network Services Protocol internet protocol number.
#define IPPROTO_MERIT_INP   32
 MERIT Internodal Protocol internet protocol number.
#define IPPROTO_DCCP   33
 Datagram Congestion Control Protocol internet protocol number.
#define IPPROTO_3PC   34
 Third Party Connect Protocol internet protocol number.
#define IPPROTO_IDPR   35
 Inter-Domain Policy Routing Protocol internet protocol number.
#define IPPROTO_XTP   36
 XTP internet protocol number.
#define IPPROTO_DDP   37
 Datagram Delivery Protocol internet protocol number.
#define IPPROTO_IDPR_CMTP   38
 IDPR Control Message Transport Proto internet protocol number.
#define IPPROTO_TP   39
 TP++ Transport Protocol internet protocol number.
#define IPPROTO_IL   40
 IL Transport Protocol internet protocol number.
#define IPPROTO_IPV6   41
 Ipv6 internet protocol number.
#define IPPROTO_SDRP   42
 Source Demand Routing Protocol internet protocol number.
#define IPPROTO_IPv6_Route   43
 Routing Header for IPv6 internet protocol number.
#define IPPROTO_IPv6_Frag   44
 Fragment Header for IPv6 internet protocol number.
#define IPPROTO_IDRP   45
 Inter-Domain Routing Protocol internet protocol number.
#define IPPROTO_RSVP   46
 Reservation Protocol internet protocol number.
#define IPPROTO_GRE   47
 General Routing Encapsulation internet protocol number.
#define IPPROTO_DSR   48
 Dynamic Source Routing Protocol internet protocol number.
#define IPPROTO_BNA   49
 BNA internet protocol number.
#define IPPROTO_ESP   50
 Encap Security Payload internet protocol number.
#define IPPROTO_AH   51
 Authentication Header internet protocol number.
#define IPPROTO_I_NLSP   52
 Integrated Net Layer Security TUBA internet protocol number.
#define IPPROTO_SWIPE   53
 IP with Encryption internet protocol number.
#define IPPROTO_NARP   54
 NBMA Address Resolution Protocol internet protocol number.
#define IPPROTO_MOBILE   55
 IP Mobility internet protocol number.
#define IPPROTO_TLSP   56
 Transport Layer Security Protocol using Kryptonet key management internet protocol number.
#define IPPROTO_SKIP   57
 SKIP internet protocol number.
#define IPPROTO_IPv6_ICMP   58
 ICMP for IPv6 internet protocol number.
#define IPPROTO_IPv6_NoNxt   59
 No Next Header for IPv6 internet protocol number.
#define IPPROTO_IPv6_Opts   60
 Destination Options for IPv6 internet protocol number.
#define IPPROTO_AHIP   61
 Any host internal protocol internet protocol number.
#define IPPROTO_CFTP   62
 CFTP internet protocol number.
#define IPPROTO_ALN   63
 Any local network internet protocol number.
#define IPPROTO_SAT_EXPAK   64
 SATNET and Backroom EXPAK internet protocol number.
#define IPPROTO_KRYPTOLAN   65
 Kryptolan internet protocol number.
#define IPPROTO_RVD   66
 MIT Remote Virtual Disk Protocol internet protocol number.
#define IPPROTO_IPPC   67
 Internet Pluribus Packet Core internet protocol number.
#define IPPROTO_ADFS   68
 Any distributed file system internet protocol number.
#define IPPROTO_SAT_MON   69
 SATNET Monitoring internet protocol number.
#define IPPROTO_VISA   70
 VISA Protocol internet protocol number.
#define IPPROTO_IPCV   71
 Internet Packet Core Utility internet protocol number.
#define IPPROTO_CPNX   72
 Computer Protocol Network Executive internet protocol number.
#define IPPROTO_CPHB   73
 Computer Protocol Heart Beat internet protocol number.
#define IPPROTO_WSN   74
 Wang Span Network internet protocol number.
#define IPPROTO_PVP   75
 Packet Video Protocol internet protocol number.
#define IPPROTO_BR_SAT_MON   76
 Backroom SATNET Monitoring internet protocol number.
#define IPPROTO_SUN_ND   77
 SUN ND IPPROTOCOL_Temporary internet protocol number.
#define IPPROTO_WB_MON   78
 WIDEBAND Monitoring internet protocol number.
#define IPPROTO_WB_EXPAK   79
 WIDEBAND EXPAK internet protocol number.
#define IPPROTO_ISO_IP   80
 ISO Internet Protocol internet protocol number.
#define IPPROTO_VMTP   81
 VMTP internet protocol number.
#define IPPROTO_SECURE_VMTP   82
 SECURE-VMTP internet protocol number.
#define IPPROTO_VINES   83
 VINES internet protocol number.
#define IPPROTO_TTP   84
 TTP internet protocol number.
#define IPPROTO_NSFNET_IGP   85
 NSFNET-IGP internet protocol number.
#define IPPROTO_DGP   86
 Dissimilar Gateway Protocol internet protocol number.
#define IPPROTO_TCF   87
 TCF internet protocol number.
#define IPPROTO_EIGRP   88
 EIGRP internet protocol number.
#define IPPROTO_OSPFIGP   89
 OSPFIGP internet protocol number.
#define IPPROTO_Sprite_RPC   90
 Sprite RPC Protocol internet protocol number.
#define IPPROTO_LARP   91
 Locus Address Resolution Protocol internet protocol number.
#define IPPROTO_MTP   92
 Multicast Transport Protocol internet protocol number.
#define IPPROTO_AX25   93
 AX.25 Frames internet protocol number.
#define IPPROTO_IPIP   94
 IP-within-IP Encapsulation Protocol internet protocol number.
#define IPPROTO_MICP   95
 Mobile Internetworking Control Pro.
#define IPPROTO_SCC_SP   96
 Semaphore Communications Sec.
#define IPPROTO_ETHERIP   97
 Ethernet-within-IP Encapsulation internet protocol number.
#define IPPROTO_ENCAP   98
 Encapsulation Header internet protocol number.
#define IPPROTO_APES   99
 Any private encryption scheme internet protocol number.
#define IPPROTO_GMTP   100
 GMTP internet protocol number.
#define IPPROTO_IFMP   101
 Ipsilon Flow Management Protocol internet protocol number.
#define IPPROTO_PNNI   102
 PNNI over IP internet protocol number.
#define IPPROTO_PIM   103
 Protocol Independent Multicast internet protocol number.
#define IPPROTO_ARIS   104
 ARIS internet protocol number.
#define IPPROTO_SCPS   105
 SCPS internet protocol number.
#define IPPROTO_QNX   106
 QNX internet protocol number.
#define IPPROTO_AN   107
 Active Networks internet protocol number.
#define IPPROTO_IPComp   108
 IP Payload Compression Protocol internet protocol number.
#define IPPROTO_SNP   109
 Sitara Networks Protocol internet protocol number.
#define IPPROTO_Compaq_Peer   110
 Compaq Peer Protocol internet protocol number.
#define IPPROTO_IPX_in_IP   111
 IPX in IP internet protocol number.
#define IPPROTO_VRRP   112
 Virtual Router Redundancy Protocol internet protocol number.
#define IPPROTO_PGM   113
 PGM Reliable Transport Protocol internet protocol number.
#define IPPROTO_A0HP   114
 Any 0-hop protocol internet protocol number.
#define IPPROTO_L2TP   115
 Layer Two Tunneling Protocol internet protocol number.
#define IPPROTO_DDX   116
 D-II Data Exchange (DDX) internet protocol number.
#define IPPROTO_IATP   117
 Interactive Agent Transfer Protocol internet protocol number.
#define IPPROTO_STP   118
 Schedule Transfer Protocol internet protocol number.
#define IPPROTO_SRP   119
 SpectraLink Radio Protocol internet protocol number.
#define IPPROTO_UTI   120
 UTI internet protocol number.
#define IPPROTO_SMP   121
 Simple Message Protocol internet protocol number.
#define IPPROTO_SM   122
 SM internet protocol number.
#define IPPROTO_PTP   123
 Performance Transparency Protocol internet protocol number.
#define IPPROTO_ISIS   124
 ISIS over IPv4 internet protocol number.
#define IPPROTO_FIRE   125
 FIRE internet protocol number.
#define IPPROTO_CRTP   126
 Combat Radio Transport Protocol internet protocol number.
#define IPPROTO_CRUDP   127
 Combat Radio User Datagram internet protocol number.
#define IPPROTO_SSCOPMCE   128
 SSCOPMCE internet protocol number.
#define IPPROTO_IPLT   129
 IPLT internet protocol number.
#define IPPROTO_SPS   130
 Secure Packet Shield internet protocol number.
#define IPPROTO_PIPE   131
 Private IP Encapsulation within IP internet protocol number.
#define IPPROTO_SCTP   132
 Stream Control Transmission Protocol internet protocol number.
#define IPPROTO_FC   133
 Fibre Channel internet protocol number.
#define IPPROTO_RSVP_E2E_IGNORE   134
 RSVP-E2E-IGNORE internet protocol number.
#define IPPROTO_MH   135
 Mobility Header internet protocol number.
#define IPPROTO_UDPLITE   136
 UDPLite internet protocol number.
#define IPPROTO_MPLS_in_IP   137
 MPLS-in-IP internet protocol number.
#define IPPROTO_manet   138
 MANET Protocols internet protocol number.
#define IPPROTO_HIP   139
 Host Identity Protocol internet protocol number.
#define IPPROTO_RAW   255
 Raw internet protocol number.
#define IPPROTO_MAX   (IPPROTO_RAW + 1)
 Maximum internet protocol number.

Define Documentation

#define ARP_FILENAME   "/srv/arp"

ARP module filename.

#define ARP_NAME   "arp"

ARP module name.

#define IP_ADDR   sizeof(struct sockaddr_in6)

IP packet address length.

Referenced by ip_packet_size_message().

#define IP_COMPUTE_FRAGMENT_OFFSET_HIGH ( length   )     ((((length) / 8u) &0x1F00) >> 8)

Returns the fragment offest high bits.

Parameters:
[in] length The prefixed data total length.

Referenced by ip_fragment_packet_data(), and ip_prepare_packet().

#define IP_COMPUTE_FRAGMENT_OFFSET_LOW ( length   )     (((length) / 8u) &0xFF)

Returns the fragment offest low bits.

Parameters:
[in] length The prefixed data total length.

Referenced by ip_fragment_packet_data(), and ip_prepare_packet().

#define IP_COMPUTE_HEADER_LENGTH ( length   )     ((uint8_t) ((length) / 4u))

Returns the IP header length.

Parameters:
[in] length The IP header length in bytes.
#define IP_FRAGMENT_OFFSET ( header   )     ((((header)->fragment_offset_high << 8) + (header)->fragment_offset_low) * 8u)

Returns the fragment offest.

Parameters:
[in] header The IP packet header.

Referenced by ip_deliver_local(), ip_fragment_packet_data(), and ip_prepare_icmp().

#define IP_GET_ADDRESS ( call   )     ({in_addr_t addr; addr.s_addr = IPC_GET_ARG3(*call); addr;})

Returns the address message parameter.

Parameters:
[in] call The message call structure.
#define IP_GET_GATEWAY ( call   )     ({in_addr_t addr; addr.s_addr = IPC_GET_ARG2(*call); addr;})

Returns the gateway message parameter.

Parameters:
[in] call The message call structure.
#define IP_GET_NETMASK ( call   )     ({in_addr_t addr; addr.s_addr = IPC_GET_ARG4(*call); addr;})

Returns the network mask message parameter.

Parameters:
[in] call The message call structure.
#define IP_GET_PROTOCOL ( call   )     ((ip_protocol_t) IPC_GET_ARG1(*call))

Returns the protocol message parameter.

Parameters:
[in] call The message call structure.
#define IP_HEADER_CHECKSUM ( header   )     (htons(ip_checksum((uint8_t *)(header), IP_HEADER_LENGTH(header))))

Returns the IP packet header checksum.

Parameters:
[in] header The IP packet header.

Referenced by ip_fragment_packet(), ip_fragment_packet_data(), ip_prepare_packet(), and ip_process_packet().

#define IP_HEADER_DATA_LENGTH ( header   )     (IP_TOTAL_LENGTH(header) - IP_HEADER_LENGTH(header))

Returns the actual IP packet data length.

Parameters:
[in] header The IP packet header.

Referenced by ip_fragment_packet(), and ip_fragment_packet_data().

#define IP_HEADER_LENGTH ( header   )     ((header)->header_length * 4u)

Returns the actual IP header length in bytes.

Parameters:
[in] header The IP packet header.

Referenced by ip_create_middle_header(), ip_fragment_packet(), ip_fragment_packet_data(), and ip_prepare_packet().

#define IP_MAX_CONTENT   65535

IP packet maximum content length.

Referenced by ip_packet_size_message(), and ip_prepare_packet().

#define IP_MIN_CONTENT   576

Minimum IP packet content.

Referenced by ip_netif_initialize().

#define IP_PREFIX   sizeof(ip_header_t)

IP packet prefix length.

Referenced by ip_packet_size_message().

#define IP_SET_HEADERLEN ( answer   )     ((size_t *) &IPC_GET_ARG2(*answer))

Sets the header length in the message answer.

Parameters:
[out] answer The message answer structure.
#define IP_SUFFIX   0

IP packet suffix length.

Referenced by ip_packet_size_message().

#define IP_TOTAL_LENGTH ( header   )     ntohs((header)->total_length)

Returns the actual IP packet total length.

Parameters:
[in] header The IP packet header.

Referenced by ip_deliver_local(), ip_fragment_packet(), and ip_fragment_packet_data().

#define IPDEFTTL   64

Default time to live counter.

#define IPFLAG_DONT_FRAGMENT   (0x1 << IPFLAG_FRAGMENT_SHIFT)

Don't fragment flag value.

Permits the packet fragmentation.

Referenced by ip_fragment_packet().

#define IPFLAG_FRAGMENT_SHIFT   1

Fragment flag field shift.

#define IPFLAG_FRAGMENTED_SHIFT   0

Fragmented flag field shift.

#define IPFLAG_LAST_FRAGMENT   (0x0 << IPFLAG_FRAGMENTED_SHIFT)

Last fragment flag value.

Indicates the last packet fragment.

#define IPFLAG_MAY_FRAGMENT   (0x0 << IPFLAG_FRAGMENT_SHIFT)

May fragment flag value.

Allows the packet fragmentation.

#define IPFLAG_MORE_FRAGMENTS   (0x1 << IPFLAG_FRAGMENTED_SHIFT)

More fragments flag value.

Indicates that more packet fragments follow.

Referenced by ip_create_middle_header(), ip_deliver_local(), ip_fragment_packet(), and ip_prepare_packet().

#define IPOPT_CIPSO   IPOPT_TYPE(IPOPT_COPY, IPOPT_CONTROL, 5)

Commercial IP security option.

#define IPOPT_CLASS (  )     ((o) &IPOPT_CLASS_MASK)

Returns an IP option class.

Parameters:
[in] o The IP option.
#define IPOPT_CLASS_MASK   0x60

Class mask.

#define IPOPT_CLASS_SHIFT   5

Class shift.

#define IPOPT_CONTROL   (0 << IPOPT_CLASS_SHIFT)

Control class.

#define IPOPT_COPIED (  )     ((o) &IPOPT_COPY)

Returns a value indicating whether the IP option should be copied.

Parameters:
[in] o The IP option.

Referenced by ip_create_last_header().

#define IPOPT_COPY   (1 << IPOPT_COPY_SHIFT)

Copy flag.

#define IPOPT_COPY_SHIFT   7

Copy shift.

#define IPOPT_END   IPOPT_TYPE(0, IPOPT_CONTROL, 0)

End of list.

Referenced by ip_create_last_header().

#define IPOPT_EOL   IPOPT_END

End of list variant.

#define IPOPT_LSRR   IPOPT_TYPE(IPOPT_COPY, IPOPT_CONTROL, 3)

Loose source.

#define IPOPT_MEASUREMENT   (2 << IPOPT_CLASS_SHIFT)

Measurement class.

#define IPOPT_NOOP   IPOPT_TYPE(0, IPOPT_CONTROL, 1)

No operation.

Referenced by ip_create_last_header().

#define IPOPT_NOP   IPOPT_NOOP

No operation variant.

#define IPOPT_NUMBER (  )     ((o) &IPOPT_NUMBER_MASK)

Returns an IP option number.

Parameters:
[in] o The IP option.
#define IPOPT_NUMBER_MASK   0x1F

Number mask.

#define IPOPT_NUMBER_SHIFT   0

Number shift.

#define IPOPT_RESERVED1   (1 << IPOPT_CLASS_SHIFT)

Reserved class 1.

#define IPOPT_RESERVED2   (3 << IPOPT_CLASS_SHIFT)

Reserved class 2.

#define IPOPT_RR   IPOPT_TYPE(IPOPT_COPY, IPOPT_CONTROL, 7)

Record route.

#define IPOPT_SEC   IPOPT_TYPE(IPOPT_COPY, IPOPT_CONTROL, 2)

Security.

#define IPOPT_SEC_CONFIDENTIAL   0xF035

Confidential.

#define IPOPT_SEC_EFTO   0x789A

EFTO.

#define IPOPT_SEC_LENGTH   11

Security length.

#define IPOPT_SEC_MMMM   0xBC4D

MMMM.

#define IPOPT_SEC_PROG   0x5E26

PROG.

#define IPOPT_SEC_RESTRICTED   0xAF13

Restricted.

#define IPOPT_SEC_SECRET   0xD788

Secret.

#define IPOPT_SEC_TOP_SECRET   0x6BC5

Top secret.

#define IPOPT_SEC_UNCLASIFIED   0x0

Unclasified.

#define IPOPT_SID   IPOPT_TYPE(IPOPT_COPY, IPOPT_CONTROL, 8)

Stream identifier.

#define IPOPT_SID_LENGTH   4

Stream identifier length.

#define IPOPT_SSRR   IPOPT_TYPE(IPOPT_COPY, IPOPT_CONTROL, 9)

Strict route.

#define IPOPT_TIMESTAMP   IPOPT_TYPE(IPOPT_COPY, IPOPT_MEASUREMENT, 4)

Internet timestamp.

#define IPOPT_TS   IPOPT_TIMESTAMP

Timestamp variant.

#define IPOPT_TS_PRESPEC   3

Specified modules only.

#define IPOPT_TS_TSANDADDR   1

Timestamps and addresses.

#define IPOPT_TS_TSONLY   0

Tiemstamp only.

#define IPOPT_TYPE ( copy,
class,
number   )     (((copy) &IPOPT_COPY) | ((class) &IPOPT_CLASS_MASK) | ((number << IPOPT_NUMBER_SHIFT) &IPOPT_NUMBER_MASK))

Returns IP option type.

Parameters:
[in] copy The value indication whether the IP option should be copied.
[in] class The IP option class.
[in] number The IP option number.
#define IPPROTO_3PC   34

Third Party Connect Protocol internet protocol number.

#define IPPROTO_A0HP   114

Any 0-hop protocol internet protocol number.

#define IPPROTO_ADFS   68

Any distributed file system internet protocol number.

#define IPPROTO_AH   51

Authentication Header internet protocol number.

#define IPPROTO_AHIP   61

Any host internal protocol internet protocol number.

#define IPPROTO_ALN   63

Any local network internet protocol number.

#define IPPROTO_AN   107

Active Networks internet protocol number.

#define IPPROTO_APES   99

Any private encryption scheme internet protocol number.

#define IPPROTO_ARGUS   13

ARGUS internet protocol number.

#define IPPROTO_ARIS   104

ARIS internet protocol number.

#define IPPROTO_AX25   93

AX.25 Frames internet protocol number.

#define IPPROTO_BBN_RCC_MON   10

BBN RCC Monitoring internet protocol number.

#define IPPROTO_BNA   49

BNA internet protocol number.

#define IPPROTO_BR_SAT_MON   76

Backroom SATNET Monitoring internet protocol number.

#define IPPROTO_CBT   7

CBT internet protocol number.

#define IPPROTO_CFTP   62

CFTP internet protocol number.

#define IPPROTO_CHAOS   16

Chaos internet protocol number.

#define IPPROTO_Compaq_Peer   110

Compaq Peer Protocol internet protocol number.

#define IPPROTO_CPHB   73

Computer Protocol Heart Beat internet protocol number.

#define IPPROTO_CPNX   72

Computer Protocol Network Executive internet protocol number.

#define IPPROTO_CRTP   126

Combat Radio Transport Protocol internet protocol number.

#define IPPROTO_CRUDP   127

Combat Radio User Datagram internet protocol number.

#define IPPROTO_DCCP   33

Datagram Congestion Control Protocol internet protocol number.

#define IPPROTO_DCN_MEAS   19

DCN Measurement Subsystems internet protocol number.

#define IPPROTO_DDP   37

Datagram Delivery Protocol internet protocol number.

#define IPPROTO_DDX   116

D-II Data Exchange (DDX) internet protocol number.

#define IPPROTO_DGP   86

Dissimilar Gateway Protocol internet protocol number.

#define IPPROTO_DSR   48

Dynamic Source Routing Protocol internet protocol number.

#define IPPROTO_EGP   8

Exterior Gateway Protocol internet protocol number.

#define IPPROTO_EIGRP   88

EIGRP internet protocol number.

#define IPPROTO_EMCON   14

EMCON internet protocol number.

#define IPPROTO_ENCAP   98

Encapsulation Header internet protocol number.

#define IPPROTO_ESP   50

Encap Security Payload internet protocol number.

#define IPPROTO_ETHERIP   97

Ethernet-within-IP Encapsulation internet protocol number.

#define IPPROTO_FC   133

Fibre Channel internet protocol number.

#define IPPROTO_FIRE   125

FIRE internet protocol number.

#define IPPROTO_GGP   3

Gateway-to-Gateway internet protocol number.

#define IPPROTO_GMTP   100

GMTP internet protocol number.

#define IPPROTO_GRE   47

General Routing Encapsulation internet protocol number.

#define IPPROTO_HIP   139

Host Identity Protocol internet protocol number.

#define IPPROTO_HMP   20

Host Monitoring internet protocol number.

#define IPPROTO_HOPOPT   0

IPv6 Hop-by-Hop Option internet protocol number.

#define IPPROTO_I_NLSP   52

Integrated Net Layer Security TUBA internet protocol number.

#define IPPROTO_IATP   117

Interactive Agent Transfer Protocol internet protocol number.

#define IPPROTO_ICMP   1

Internet Control Message internet protocol number.

Referenced by icmp_send_packet(), ip_get_icmp_phone(), and ip_prepare_icmp().

#define IPPROTO_IDPR   35

Inter-Domain Policy Routing Protocol internet protocol number.

#define IPPROTO_IDPR_CMTP   38

IDPR Control Message Transport Proto internet protocol number.

#define IPPROTO_IDRP   45

Inter-Domain Routing Protocol internet protocol number.

#define IPPROTO_IFMP   101

Ipsilon Flow Management Protocol internet protocol number.

#define IPPROTO_IGMP   2

Internet Group Management internet protocol number.

#define IPPROTO_IGP   9

any private interior gateway (used by Cisco for their IGRP) internet protocol number.

#define IPPROTO_IL   40

IL Transport Protocol internet protocol number.

#define IPPROTO_IP   4

IP in IP (encapsulation) internet protocol number.

#define IPPROTO_IPComp   108

IP Payload Compression Protocol internet protocol number.

#define IPPROTO_IPCV   71

Internet Packet Core Utility internet protocol number.

#define IPPROTO_IPIP   94

IP-within-IP Encapsulation Protocol internet protocol number.

#define IPPROTO_IPLT   129

IPLT internet protocol number.

#define IPPROTO_IPPC   67

Internet Pluribus Packet Core internet protocol number.

#define IPPROTO_IPV6   41

Ipv6 internet protocol number.

#define IPPROTO_IPv6_Frag   44

Fragment Header for IPv6 internet protocol number.

#define IPPROTO_IPv6_ICMP   58

ICMP for IPv6 internet protocol number.

#define IPPROTO_IPv6_NoNxt   59

No Next Header for IPv6 internet protocol number.

#define IPPROTO_IPv6_Opts   60

Destination Options for IPv6 internet protocol number.

#define IPPROTO_IPv6_Route   43

Routing Header for IPv6 internet protocol number.

#define IPPROTO_IPX_in_IP   111

IPX in IP internet protocol number.

#define IPPROTO_IRTP   28

Internet Reliable Transaction internet protocol number.

#define IPPROTO_ISIS   124

ISIS over IPv4 internet protocol number.

#define IPPROTO_ISO_IP   80

ISO Internet Protocol internet protocol number.

#define IPPROTO_ISO_TP4   29

ISO Transport Protocol Class 4 internet protocol number.

#define IPPROTO_KRYPTOLAN   65

Kryptolan internet protocol number.

#define IPPROTO_L2TP   115

Layer Two Tunneling Protocol internet protocol number.

#define IPPROTO_LARP   91

Locus Address Resolution Protocol internet protocol number.

#define IPPROTO_LEAF_1   25

Leaf-1 internet protocol number.

#define IPPROTO_LEAF_2   26

Leaf-2 internet protocol number.

#define IPPROTO_manet   138

MANET Protocols internet protocol number.

#define IPPROTO_MAX   (IPPROTO_RAW + 1)

Maximum internet protocol number.

#define IPPROTO_MERIT_INP   32

MERIT Internodal Protocol internet protocol number.

#define IPPROTO_MFE_NSP   31

MFE Network Services Protocol internet protocol number.

#define IPPROTO_MH   135

Mobility Header internet protocol number.

#define IPPROTO_MICP   95

Mobile Internetworking Control Pro.

internet protocol number.

#define IPPROTO_MOBILE   55

IP Mobility internet protocol number.

#define IPPROTO_MPLS_in_IP   137

MPLS-in-IP internet protocol number.

#define IPPROTO_MTP   92

Multicast Transport Protocol internet protocol number.

#define IPPROTO_MUX   18

Multiplexing internet protocol number.

#define IPPROTO_NARP   54

NBMA Address Resolution Protocol internet protocol number.

#define IPPROTO_NETBLT   30

Bulk Data Transfer Protocol internet protocol number.

#define IPPROTO_NSFNET_IGP   85

NSFNET-IGP internet protocol number.

#define IPPROTO_NVP_II   11

Network Voice Protocol internet protocol number.

#define IPPROTO_OSPFIGP   89

OSPFIGP internet protocol number.

#define IPPROTO_PGM   113

PGM Reliable Transport Protocol internet protocol number.

#define IPPROTO_PIM   103

Protocol Independent Multicast internet protocol number.

#define IPPROTO_PIPE   131

Private IP Encapsulation within IP internet protocol number.

#define IPPROTO_PNNI   102

PNNI over IP internet protocol number.

#define IPPROTO_PRM   21

Packet Radio Measurement internet protocol number.

#define IPPROTO_PTP   123

Performance Transparency Protocol internet protocol number.

#define IPPROTO_PUP   12

PUP internet protocol number.

#define IPPROTO_PVP   75

Packet Video Protocol internet protocol number.

#define IPPROTO_QNX   106

QNX internet protocol number.

#define IPPROTO_RAW   255

Raw internet protocol number.

#define IPPROTO_RDP   27

Reliable Data Protocol internet protocol number.

#define IPPROTO_RSVP   46

Reservation Protocol internet protocol number.

#define IPPROTO_RSVP_E2E_IGNORE   134

RSVP-E2E-IGNORE internet protocol number.

#define IPPROTO_RVD   66

MIT Remote Virtual Disk Protocol internet protocol number.

#define IPPROTO_SAT_EXPAK   64

SATNET and Backroom EXPAK internet protocol number.

#define IPPROTO_SAT_MON   69

SATNET Monitoring internet protocol number.

#define IPPROTO_SCC_SP   96

Semaphore Communications Sec.

Pro. internet protocol number.

#define IPPROTO_SCPS   105

SCPS internet protocol number.

#define IPPROTO_SCTP   132

Stream Control Transmission Protocol internet protocol number.

#define IPPROTO_SDRP   42

Source Demand Routing Protocol internet protocol number.

#define IPPROTO_SECURE_VMTP   82

SECURE-VMTP internet protocol number.

#define IPPROTO_SKIP   57

SKIP internet protocol number.

#define IPPROTO_SM   122

SM internet protocol number.

#define IPPROTO_SMP   121

Simple Message Protocol internet protocol number.

#define IPPROTO_SNP   109

Sitara Networks Protocol internet protocol number.

#define IPPROTO_Sprite_RPC   90

Sprite RPC Protocol internet protocol number.

#define IPPROTO_SPS   130

Secure Packet Shield internet protocol number.

#define IPPROTO_SRP   119

SpectraLink Radio Protocol internet protocol number.

#define IPPROTO_SSCOPMCE   128

SSCOPMCE internet protocol number.

#define IPPROTO_ST   5

Stream internet protocol number.

#define IPPROTO_STP   118

Schedule Transfer Protocol internet protocol number.

#define IPPROTO_SUN_ND   77

SUN ND IPPROTOCOL_Temporary internet protocol number.

#define IPPROTO_SWIPE   53

IP with Encryption internet protocol number.

#define IPPROTO_TCF   87

TCF internet protocol number.

#define IPPROTO_TCP   6

Transmission Control internet protocol number.

Referenced by socket(), tcp_connect_core(), tcp_process_packet(), and tcp_send_prepare_packet().

#define IPPROTO_TLSP   56

Transport Layer Security Protocol using Kryptonet key management internet protocol number.

#define IPPROTO_TP   39

TP++ Transport Protocol internet protocol number.

#define IPPROTO_TRUNK_1   23

Trunk-1 internet protocol number.

#define IPPROTO_TRUNK_2   24

Trunk-2 internet protocol number.

#define IPPROTO_TTP   84

TTP internet protocol number.

#define IPPROTO_UDP   17

User Datagram internet protocol number.

Referenced by socket(), udp_process_packet(), and udp_sendto_message().

#define IPPROTO_UDPLITE   136

UDPLite internet protocol number.

#define IPPROTO_UTI   120

UTI internet protocol number.

#define IPPROTO_VINES   83

VINES internet protocol number.

#define IPPROTO_VISA   70

VISA Protocol internet protocol number.

#define IPPROTO_VMTP   81

VMTP internet protocol number.

#define IPPROTO_VRRP   112

Virtual Router Redundancy Protocol internet protocol number.

#define IPPROTO_WB_EXPAK   79

WIDEBAND EXPAK internet protocol number.

#define IPPROTO_WB_MON   78

WIDEBAND Monitoring internet protocol number.

#define IPPROTO_WSN   74

Wang Span Network internet protocol number.

#define IPPROTO_XNET   15

Cross Net Debugger internet protocol number.

#define IPPROTO_XNS_IDP   22

XEROX NS IDP internet protocol number.

#define IPPROTO_XTP   36

XTP internet protocol number.

#define IPTOS_COST_SHIFT   1

Cost shift.

#define IPTOS_DELAY_SHIFT   4

Delay shift.

#define IPTOS_LOWDELAY   (0x1 << IPTOS_DELAY_SHIFT)

Low delay.

#define IPTOS_MICNCOST   (0x1 << IPTOS_COST_SHIFT)

Minimum cost.

#define IPTOS_NORMALCOST   (0x0 << IPTOS_COST_SHIFT)

Normal cost.

#define IPTOS_NORMALDELAY   (0x0 << IPTOS_DELAY_SHIFT)

Normal delay.

#define IPTOS_NORMALRELIABILITY   (0x0 << IPTOS_RELIABILITY_SHIFT)

Normal reliability.

#define IPTOS_NORMALTHROUGHPUT   (0x0 << IPTOS_THROUGHPUT_SHIFT)

Normal throughput.

#define IPTOS_PREC_CRITIC_ECP   (0x5 << IPTOS_PRECEDENCE_SHIFT)

Critical precedence.

#define IPTOS_PREC_FLASH   (0x3 << IPTOS_PRECEDENCE_SHIFT)

Flash precedence.

#define IPTOS_PREC_FLASHOVERRIDE   (0x4 << IPTOS_PRECEDENCE_SHIFT)

Flash override precedence.

#define IPTOS_PREC_IMMEDIATE   (0x2 << IPTOS_PRECEDENCE_SHIFT)

Immediate precedence.

#define IPTOS_PREC_INTERNETCONTROL   (0x6 << IPTOS_PRECEDENCE_SHIFT)

Inter-network control precedence.

#define IPTOS_PREC_MASK   0xE0

Precedence mask.

#define IPTOS_PREC_NETCONTROL   (0x7 << IPTOS_PRECEDENCE_SHIFT)

Network control precedence.

#define IPTOS_PREC_PRIORITY   (0x1 << IPTOS_PRECEDENCE_SHIFT)

Priority precedence.

#define IPTOS_PREC_ROUTINE   (0x0 << IPTOS_PRECEDENCE_SHIFT)

Routine precedence.

#define IPTOS_PRECEDENCE_SHIFT   5

Precedence shift.

#define IPTOS_RELIABILITY   (0x1 << IPTOS_RELIABILITY_SHIFT)

Reliability.

#define IPTOS_RELIABILITY_SHIFT   2

Reliability shift.

#define IPTOS_THROUGHPUT   (0x1 << IPTOS_THROUGHPUT_SHIFT)

Throughput.

#define IPTOS_THROUGHPUT_SHIFT   3

Throughput shift.

#define IPTOS_TOS_MASK   0x1E

IP TOS mask.

#define IPV4   4

IP version 4.

Referenced by ip_netif_initialize(), and ip_prepare_packet().

#define IPV4_LOCALHOST_ADDRESS   htonl((127 << 24) + 1)

The IP localhost address.

#define IPVERSION   4

Default IPVERSION.

Referenced by ip_deliver_local(), ip_prepare_icmp(), and ip_process_packet().

#define MAXTTL   255

Maximum time to live counter.

#define NAME   "IP protocol"

IP module name.

#define NET_DEFAULT_IP_ROUTING   false

Default network interface IP routing.

Referenced by ip_netif_initialize().

#define NET_DEFAULT_IPV   IPV4

Default network interface IP version.

Referenced by ip_netif_initialize().


Typedef Documentation

typedef struct ip_globals ip_globals_t

Type definition of the IP global data.

See also:
ip_globals

Type definition of the internet header pointer.

See also:
ip_header
typedef struct ip_header ip_header_t

Type definition of the internet header.

See also:
ip_header

Type definition of the IP network interface specific data pointer.

See also:
ip_netif
typedef struct ip_netif ip_netif_t

Type definition of the IP network interface specific data.

See also:
ip_netif

Type definition of the internet option header pointer.

See also:
ip_header
typedef struct ip_option ip_option_t

Type definition of the internet option header.

See also:
ip_header

Type definition of the IP protocol specific data pointer.

See also:
ip_proto
typedef struct ip_proto ip_proto_t

Type definition of the IP protocol specific data.

See also:
ip_proto
typedef uint8_t ip_protocol_t

IP transport protocol type definition.

typedef void* ip_pseudo_header_ref

Type definition of the internet pseudo header pointer.

Type definition of the IP route specific data pointer.

See also:
ip_route
typedef struct ip_route ip_route_t

Type definition of the IP route specific data.

See also:
ip_route
typedef uint8_t ip_tos_t

IP type of service type definition.

typedef uint8_t ip_ttl_t

IP time to live counter type definition.

Type definition of the internet version 4 pseudo header pointer.

See also:
ipv4_pseudo_header

Type definition of the internet version 4 pseudo header.

See also:
ipv4_pseudo_header
typedef int(* tl_received_msg_t)(device_id_t device_id, packet_t packet, services_t receiver, services_t error)

The transport layer notification function type definition.

Notifies the transport layer modules about the received packet/s.

Parameters:
[in] device_id The device identifier.
[in] packet The received packet or the received packet queue.
[in] receiver The receiving module service.
[in] error The packet error reporting service. Prefixes the received packet.
Returns:
EOK on success.

Enumeration Type Documentation

IP module messages.

Enumerator:
NET_IP_ADD_ROUTE 

Adds the routing entry.

See also:
ip_add_route()
NET_IP_GET_ROUTE 

Gets the actual route information.

See also:
ip_get_route()
NET_IP_RECEIVED_ERROR 

Processes the received error notification.

See also:
ip_received_error_msg()
NET_IP_SET_GATEWAY 

Sets the default gateway.

See also:
ip_set_default_gateway()

Function Documentation

int ip_add_route_req ( int  ip_phone,
device_id_t  device_id,
in_addr_t  address,
in_addr_t  netmask,
in_addr_t  gateway 
)

Adds a route to the device routing table.

The target network is routed using this device.

Parameters:
[in] ip_phone The IP module phone used for (semi)remote calls.
[in] device_id The device identifier.
[in] address The target network address.
[in] netmask The target network mask.
[in] gateway The target network gateway. Not used if zero.

References NET_IP_ADD_ROUTE, and in_addr::s_addr.

int ip_bind_service ( services_t  service,
int  protocol,
services_t  me,
async_client_conn_t  receiver,
tl_received_msg_t  tl_received_msg 
)

Creates bidirectional connection with the ip module service and registers the message receiver.

Parameters:
[in] service The IP module service.
[in] protocol The transport layer protocol.
[in] me The requesting module service.
[in] receiver The message receiver. Used for remote connection.
[in] tl_received_msg The message processing function. Used if bundled together.
Returns:
The phone of the needed service.
EOK on success.
Other error codes as defined for the bind_service() function.

References bind_service().

Here is the call graph for this function:

int ip_client_get_pseudo_header ( ip_protocol_t  protocol,
struct sockaddr src,
socklen_t  srclen,
struct sockaddr dest,
socklen_t  destlen,
size_t  data_length,
ip_pseudo_header_ref header,
size_t *  headerlen 
)

Constructs the IPv4 pseudo header.

Parameters:
[in] protocol The transport protocol.
[in] src The source address.
[in] srclen The source address length.
[in] dest The destination address.
[in] destlen The destination address length.
[in] data_length The data length to be set.
[out] header The constructed IPv4 pseudo header.
[out] headerlen The length of the IP pseudo header in bytes.
Returns:
EOK on success.
EBADMEM if the header and/or the headerlen parameter is NULL.
EINVAL if the source address and/or the destination address parameter is NULL.
EINVAL if the source address length is less than struct sockaddr length.
EINVAL if the source address length differs from the destination address length.
EINVAL if the source address family differs from the destination family.
EAFNOSUPPORT if the address family is not supported.
ENOMEM if there is not enough memory left.

Referenced by tcp_process_packet(), and udp_process_packet().

Here is the caller graph for this function:

size_t ip_client_header_length ( packet_t  packet  ) 

Returns the IP header length.

Parameters:
[in] packet The packet.
Returns:
The IP header length in bytes.
Zero (0) if there is no IP header.

Referenced by icmp_prepare_packet(), and icmp_process_packet().

Here is the caller graph for this function:

int ip_client_prepare_packet ( packet_t  packet,
ip_protocol_t  protocol,
ip_ttl_t  ttl,
ip_tos_t  tos,
int  dont_fragment,
size_t  ipopt_length 
)

Prepares the packet to be transfered via IP.

The IP header is prefixed.

Parameters:
[in,out] packet The packet to be prepared.
[in] protocol The transport protocol.
[in] ttl The time to live counter. The IPDEFTTL is set if zero (0).
[in] tos The type of service.
[in] dont_fragment The value indicating whether fragmentation is disabled.
[in] ipopt_length The prefixed IP options length in bytes.
Returns:
EOK on success.
ENOMEM if there is not enough memory left in the packet.

Referenced by icmp_send_packet(), tcp_send_prepare_packet(), and udp_sendto_message().

Here is the caller graph for this function:

int ip_client_process_packet ( packet_t  packet,
ip_protocol_t protocol,
ip_ttl_t ttl,
ip_tos_t tos,
int *  dont_fragment,
size_t *  ipopt_length 
)

Processes the received IP packet.

Fills set header fields. Returns the prefixed IP header length.

Parameters:
[in] packet The received packet.
[out] protocol The transport protocol. May be NULL if not desired.
[out] ttl The time to live counter. May be NULL if not desired.
[out] tos The type of service. May be NULL if not desired.
[out] dont_fragment The value indicating whether the fragmentation is disabled. May be NULL if not desired.
[out] ipopt_length The IP options length in bytes. May be NULL if not desired.
Returns:
The prefixed IP header length in bytes on success.
ENOMEM if the packet is too short to contain the IP header.

Referenced by tcp_process_packet(), and udp_process_packet().

Here is the caller graph for this function:

int ip_client_set_pseudo_header_data_length ( ip_pseudo_header_ref  header,
size_t  headerlen,
size_t  data_length 
)

Updates the IPv4 pseudo header data length field.

Parameters:
[in,out] header The IPv4 pseudo header to be updated.
[in] headerlen The length of the IP pseudo header in bytes.
[in] data_length The data length to be set.
Returns:
EOK on success.
EBADMEM if the header parameter is NULL.
EINVAL if the headerlen parameter is not IPv4 pseudo header length.

Referenced by tcp_process_packet(), tcp_send_prepare_packet(), and udp_sendto_message().

Here is the caller graph for this function:

int ip_connect_module ( services_t  service  ) 

Connects to the IP module.

Parameters:
service The IP module service. Ignored parameter.
Returns:
The IP module phone on success.
0 if called by the bundle module.

References connect_to_service().

Referenced by net_initialize_build().

Here is the call graph for this function:

Here is the caller graph for this function:

void ip_create_last_header ( ip_header_ref  last,
ip_header_ref  first 
)

Copies the fragment header.

Copies only the header itself and relevant IP options.

Parameters:
[out] last The created header.
[in] first The original header to be copied.

References ip_header::header_checksum, ip_header::header_length, IPOPT_COPIED, IPOPT_END, IPOPT_NOOP, ip_option::length, and ip_option::type.

Referenced by ip_fragment_packet(), and ip_prepare_packet().

Here is the caller graph for this function:

ip_header_ref ip_create_middle_header ( packet_t  packet,
ip_header_ref  last 
)

Prefixes a middle fragment header based on the last fragment header to the packet.

Parameters:
[in] packet The packet to be prefixed.
[in] last The last header to be copied.
Returns:
The prefixed middle header.
NULL on error.

References ip_header::flags, IP_HEADER_LENGTH, IPFLAG_MORE_FRAGMENTS, and packet_suffix().

Referenced by ip_fragment_packet().

Here is the call graph for this function:

Here is the caller graph for this function:

int ip_deliver_local ( device_id_t  device_id,
packet_t  packet,
ip_header_ref  header,
services_t  error 
)

Delivers the packet to the local host.

The packet is either passed to another module or released on error. The ICMP_PROT_UNREACH error notification may be sent if the protocol is not found.

Parameters:
[in] device_id The source device identifier.
[in] packet The packet to be delivered.
[in] header The first packet IP header. May be NULL.
[in] error The packet error service.
Returns:
EOK on success.
ENOTSUP if the packet is a fragment.
EAFNOSUPPORT if the address family is not supported.
ENOENT if the target protocol is not found.
Other error codes as defined for the packet_set_addr() function.
Other error codes as defined for the packet_trim() function.
Other error codes as defined for the protocol specific tl_received_msg function.

References AF_INET, ip_header::destination_address, EAFNOSUPPORT, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ip_header::flags, icmp_destination_unreachable_msg(), ICMP_PROT_UNREACH, IP_FRAGMENT_OFFSET, ip_prepare_icmp_and_get_phone(), ip_release_and_return(), IP_TOTAL_LENGTH, IPFLAG_MORE_FRAGMENTS, IPVERSION, packet_get_data_length(), packet_set_addr(), packet_trim(), ip_proto::phone, ip_header::protocol, ip_globals::protos, ip_globals::protos_lock, ip_proto::received_msg, in_addr::s_addr, ip_proto::service, sockaddr_in::sin_addr, sockaddr_in::sin_family, ip_header::source_address, tl_received_msg(), and ip_header::version.

Referenced by ip_process_packet().

Here is the call graph for this function:

Here is the caller graph for this function:

int ip_device_req ( int  ip_phone,
device_id_t  device_id,
services_t  netif 
)

Registers the new device.

Registers itself as the ip packet receiver. If the device uses ARP registers also the new ARP device.

Parameters:
[in] ip_phone The IP module phone used for (semi)remote calls.
[in] device_id The new device identifier.
[in] netif The underlying device network interface layer service.
Returns:
EOK on success.
ENOMEM if there is not enough memory left.
EINVAL if the device configuration is invalid.
ENOTSUP if the device uses IPv6.
ENOTSUP if the device uses DHCP.
Other error codes as defined for the net_get_device_conf_req() function.
Other error codes as defined for the arp_device_req() function.

References generic_device_req(), and NET_IL_DEVICE.

Referenced by start_device().

Here is the call graph for this function:

Here is the caller graph for this function:

int ip_device_state_message ( device_id_t  device_id,
device_state_t  state 
)

Updates the device state.

Parameters:
[in] device_id The device identifier.
[in] state The new state value.
Returns:
EOK on success.
ENOENT if device is not found.

References ip_globals::netifs, ip_globals::netifs_lock, and ip_netif::state.

ip_route_ref ip_find_route ( in_addr_t  destination  ) 

Searches all network interfaces if there is a suitable route.

Parameters:
[in] destination The destination address.
Returns:
The found route.
NULL if no route was found.

References ip_globals::gateway, ip_netif_find_route(), NETIF_ACTIVE, ip_globals::netifs, and ip_netif::state.

Referenced by ip_process_packet().

Here is the call graph for this function:

Here is the caller graph for this function:

int ip_fragment_packet ( packet_t  packet,
size_t  length,
size_t  prefix,
size_t  suffix,
socklen_t  addr_len 
)

Checks the packet length and fragments it if needed.

The new fragments are queued before the original packet.

Parameters:
[in,out] packet The packet to be checked.
[in] length The maximum packet length.
[in] prefix The minimum prefix size.
[in] suffix The minimum suffix size.
[in] addr_len The minimum address length.
Returns:
EOK on success.
EINVAL if the packet_get_addr() function fails.
EINVAL if the packet does not contain the IP header.
EPERM if the packet needs to be fragmented and the fragmentation is not allowed.
ENOMEM if there is not enough memory left.
ENOMEM if there is no packet available.
ENOMEM if the packet is too small to contain the IP header.
Other error codes as defined for the packet_trim() function.
Other error codes as defined for the ip_create_middle_header() function.
Other error codes as defined for the ip_fragment_packet_data() function.

References ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ip_header::flags, ip_header::header_checksum, ip_create_last_header(), ip_create_middle_header(), ip_fragment_packet_data(), IP_HEADER_CHECKSUM, IP_HEADER_DATA_LENGTH, IP_HEADER_LENGTH, ip_release_and_return(), IP_TOTAL_LENGTH, IPFLAG_DONT_FRAGMENT, IPFLAG_MORE_FRAGMENTS, ip_globals::net_phone, packet_get_4(), packet_get_addr(), packet_get_data(), packet_get_data_length(), packet_suffix(), and packet_trim().

Referenced by ip_split_packet().

Here is the call graph for this function:

Here is the caller graph for this function:

int ip_fragment_packet_data ( packet_t  packet,
packet_t  new_packet,
ip_header_ref  header,
ip_header_ref  new_header,
size_t  length,
const struct sockaddr src,
const struct sockaddr dest,
socklen_t  addrlen 
)

Fragments the packet from the end.

Parameters:
[in] packet The packet to be fragmented.
[in,out] new_packet The new packet fragment.
[in,out] header The original packet header.
[in,out] new_header The new packet fragment header.
[in] length The new fragment length.
[in] src The source address.
[in] dest The destiantion address.
[in] addrlen The address length.
Returns:
EOK on success.
ENOMEM if the target packet is too small.
Other error codes as defined for the packet_set_addr() function.
Other error codes as defined for the pq_insert_after() function.

References ERROR_DECLARE, ERROR_PROPAGATE, ip_header::fragment_offset_high, ip_header::fragment_offset_low, ip_header::header_checksum, htons, IP_COMPUTE_FRAGMENT_OFFSET_HIGH, IP_COMPUTE_FRAGMENT_OFFSET_LOW, IP_FRAGMENT_OFFSET, IP_HEADER_CHECKSUM, IP_HEADER_DATA_LENGTH, IP_HEADER_LENGTH, IP_TOTAL_LENGTH, packet_set_addr(), packet_suffix(), packet_trim(), pq_insert_after(), and ip_header::total_length.

Referenced by ip_fragment_packet().

Here is the call graph for this function:

Here is the caller graph for this function:

in_addr_t ip_get_destination ( ip_header_ref  header  ) 

Returns the packet destination address from the IP header.

Parameters:
[in] header The packet IP header to be read.
Returns:
The packet destination address.

References ip_header::destination_address, and in_addr::s_addr.

Referenced by ip_process_packet().

Here is the caller graph for this function:

int ip_get_icmp_phone ( void   ) 

Returns the ICMP phone.

Searches the registered protocols.

Returns:
The found ICMP phone.
ENOENT if the ICMP is not registered.

References IPPROTO_ICMP, ip_proto::phone, ip_globals::protos, and ip_globals::protos_lock.

Referenced by ip_prepare_icmp_and_get_phone().

Here is the caller graph for this function:

int ip_get_route_req ( int  ip_phone,
ip_protocol_t  protocol,
const struct sockaddr destination,
socklen_t  addrlen,
device_id_t device_id,
ip_pseudo_header_ref header,
size_t *  headerlen 
)

Returns the device identifier and the IP pseudo header based on the destination address.

Parameters:
[in] ip_phone The IP module phone used for (semi)remote calls.
[in] protocol The transport protocol.
[in] destination The destination address.
[in] addrlen The destination address length.
[out] device_id The device identifier.
[out] header The constructed IP pseudo header.
[out] headerlen The IP pseudo header length.

References free, IPC_GET_DEVICE, and NET_IP_GET_ROUTE.

Referenced by tcp_connect_core(), and udp_sendto_message().

Here is the caller graph for this function:

int ip_initialize ( async_client_conn_t  client_connection  ) 

Initializes the IP module.

Parameters:
[in] client_connection The client connection processing function. The module skeleton propagates its own one.
Returns:
EOK on success.
ENOMEM if there is not enough memory left.

Referenced by module_start().

Here is the caller graph for this function:

int ip_message ( ipc_callid_t  callid,
ipc_call_t *  call,
ipc_call_t *  answer,
int *  answer_count 
)

Processes the IP message.

Parameters:
[in] callid The message identifier.
[in] call The message parameters.
[out] answer The message answer parameters.
[out] answer_count The last parameter for the actual answer in the answer parameter.
Returns:
EOK on success.
ENOTSUP if the message is not known.
See also:
ip_interface.h
il_interface.h
IS_NET_IP_MESSAGE()

Referenced by module_message().

Here is the caller graph for this function:

int ip_mtu_changed_message ( device_id_t  device_id,
size_t  mtu 
)

Updates the device content length according to the new MTU value.

Parameters:
[in] device_id The device identifier.
[in] mtu The new mtu value.
Returns:
EOK on success.
ENOENT if device is not found.

References packet_dimension::content, ip_globals::netifs, ip_globals::netifs_lock, and ip_netif::packet_dimension.

in_addr_t * ip_netif_address ( ip_netif_ref  netif  ) 

Returns the network interface's IP address.

Parameters:
[in] netif The network interface.
Returns:
The IP address.
NULL if no IP address was found.

References ip_route::address, and ip_netif::routes.

ip_route_ref ip_netif_find_route ( ip_netif_ref  netif,
in_addr_t  destination 
)

Searches the network interfaces if there is a suitable route.

Parameters:
[in] netif The network interface to be searched for routes. May be NULL.
[in] destination The destination address.
Returns:
The found route.
NULL if no route was found.

References ip_route::address, ip_route::netmask, ip_netif::routes, and in_addr::s_addr.

Referenced by ip_find_route().

Here is the caller graph for this function:

int ip_netif_initialize ( ip_netif_ref  ip_netif  ) 

Initializes a new network interface specific data.

Connects to the network interface layer module, reads the netif configuration, starts an ARP module if needed and sets the netif routing table. The device identifier and the nil service has to be set.

Parameters:
[in,out] ip_netif Network interface specific data.
Returns:
EOK on success.
ENOTSUP if DHCP is configured.
ENOTSUP if IPv6 is configured.
EINVAL if any of the addresses is invalid.
EINVAL if the used ARP module is not known.
ENOMEM if there is not enough memory left.
Other error codes as defined for the net_get_device_conf_req() function.
Other error codes as defined for the bind_service() function.
Other error codes as defined for the specific arp_device_req() function.
Other error codes as defined for the nil_packet_size_req() function.

References ip_route::address, AF_INET, ip_netif::arp, arp_device_req(), ip_netif::broadcast, ip_globals::client_connection, packet_dimension::content, CONVERT_SIZE, count, ip_netif::device_id, ip_netif::dhcp, ERROR_DECLARE, ERROR_OCCURRED, ERROR_PROPAGATE, free, ip_globals::gateway, ip_route::gateway, get_running_module(), inet_pton(), IP_MIN_CONTENT, ip_netif::ipv, IPV4, measured_string::length, ip_globals::modules, NET_DEFAULT_IP_ROUTING, NET_DEFAULT_IPV, net_free_settings(), net_get_device_conf_req(), ip_globals::net_phone, ip_route::netif, ip_globals::netifs, ip_route::netmask, nil_bind_service, nil_packet_size_req, ip_netif::packet_dimension, module_struct::phone, ip_netif::phone, ip_netif::routes, ip_netif::routing, in_addr::s_addr, ip_netif::service, and measured_string::value.

Here is the call graph for this function:

int ip_packet_size_message ( device_id_t  device_id,
size_t *  addr_len,
size_t *  prefix,
size_t *  content,
size_t *  suffix 
)

Returns the device packet dimensions for sending.

Parameters:
[in] phone The service module phone.
[in] message The service specific message.
[in] device_id The device identifier.
[out] addr_len The minimum reserved address length.
[out] prefix The minimum reserved prefix size.
[out] content The maximum content size.
[out] suffix The minimum reserved suffix size.
Returns:
EOK on success.

References packet_dimension::addr_len, IP_ADDR, IP_MAX_CONTENT, IP_PREFIX, IP_SUFFIX, ip_globals::netifs, ip_globals::netifs_lock, ip_netif::packet_dimension, packet_dimension::prefix, and packet_dimension::suffix.

int ip_packet_size_req ( int  ip_phone,
device_id_t  device_id,
packet_dimension_ref  packet_dimension 
)

Returns the device packet dimension for sending.

Parameters:
[in] ip_phone The IP module phone used for (semi)remote calls.
[in] device_id The device identifier.
[out] packet_dimension The packet dimension.
Returns:
EOK on success.
ENOENT if there is no such device.
Other error codes as defined for the generic_packet_size_req() function.

References generic_packet_size_req(), and NET_IL_PACKET_SPACE.

Referenced by icmp_echo(), and udp_sendto_message().

Here is the call graph for this function:

Here is the caller graph for this function:

int ip_prepare_icmp ( packet_t  packet,
ip_header_ref  header 
)

Prepares the ICMP notification packet.

Releases additional packets and keeps only the first one.

Parameters:
[in] packet The packet or the packet queue to be reported as faulty.
[in] header The first packet IP header. May be NULL.
Returns:
EOK on success.
EINVAL if there are no data in the packet.
EINVAL if the packet is a fragment.
ENOMEM if the packet is too short to contain the IP header.
EAFNOSUPPORT if the address family is not supported.
EPERM if the protocol is not allowed to send ICMP notifications. The ICMP protocol itself.
Other error codes as defined for the packet_set_addr().

References AF_INET, EAFNOSUPPORT, IP_FRAGMENT_OFFSET, IPPROTO_ICMP, IPVERSION, ip_globals::net_phone, packet_get_data(), packet_get_data_length(), packet_get_id(), packet_set_addr(), pq_detach(), pq_release(), ip_header::protocol, in_addr::s_addr, sockaddr_in::sin_addr, sockaddr_in::sin_family, ip_header::source_address, and ip_header::version.

Referenced by ip_prepare_icmp_and_get_phone().

Here is the call graph for this function:

Here is the caller graph for this function:

int ip_prepare_icmp_and_get_phone ( services_t  error,
packet_t  packet,
ip_header_ref  header 
)

Prepares the ICMP notification packet.

Releases additional packets and keeps only the first one. All packets is released on error.

Parameters:
[in] error The packet error service.
[in] packet The packet or the packet queue to be reported as faulty.
[in] header The first packet IP header. May be NULL.
Returns:
The found ICMP phone.
EINVAL if the error parameter is set.
EINVAL if the ICMP phone is not found.
EINVAL if the ip_prepare_icmp() fails.

References ip_get_icmp_phone(), ip_prepare_icmp(), and ip_release_and_return().

Referenced by ip_deliver_local(), ip_process_packet(), ip_send_route(), and ip_split_packet().

Here is the call graph for this function:

Here is the caller graph for this function:

int ip_prepare_packet ( in_addr_t source,
in_addr_t  dest,
packet_t  packet,
measured_string_ref  destination 
)

Prepares the outgoing packet or the packet queue.

The packet queue is a fragmented packet Updates the first packet's IP header. Prefixes the additional packets with fragment headers.

Parameters:
[in] source The source address.
[in] dest The destination address.
[in,out] packet The packet to be sent.
[in] destination The destination hardware address.
Returns:
EOK on success.
EINVAL if the packet is too small to contain the IP header.
EINVAL if the packet is too long than the IP allows.
ENOMEM if there is not enough memory left.
Other error codes as defined for the packet_set_addr() function.

References CONVERT_SIZE, ip_header::destination_address, ERROR_DECLARE, ERROR_PROPAGATE, ip_header::flags, ip_header::fragment_offset_high, ip_header::fragment_offset_low, free, ip_header::header_checksum, htons, ip_header::identification, IP_COMPUTE_FRAGMENT_OFFSET_HIGH, IP_COMPUTE_FRAGMENT_OFFSET_LOW, ip_create_last_header(), IP_HEADER_CHECKSUM, IP_HEADER_LENGTH, IP_MAX_CONTENT, IPFLAG_MORE_FRAGMENTS, IPV4, measured_string::length, ip_globals::lock, ip_globals::packet_counter, packet_get_data(), packet_get_data_length(), packet_prefix(), packet_set_addr(), pq_next(), in_addr::s_addr, ip_header::source_address, ip_header::total_length, measured_string::value, and ip_header::version.

Referenced by ip_send_route().

Here is the call graph for this function:

Here is the caller graph for this function:

int ip_process_packet ( device_id_t  device_id,
packet_t  packet 
)

Processes the received packet.

The packet is either passed to another module or released on error. The ICMP_PARAM_POINTER error notification may be sent if the checksum is invalid. The ICMP_EXC_TTL error notification may be sent if the TTL is less than two (2). The ICMP_HOST_UNREACH error notification may be sent if no route was found. The ICMP_HOST_UNREACH error notification may be sent if the packet is for another host and the routing is disabled.

Parameters:
[in] device_id The source device identifier.
[in] packet The received packet to be processed.
Returns:
EOK on success.
EINVAL if the TTL is less than two (2).
EINVAL if the checksum is invalid.
EAFNOSUPPORT if the address family is not supported.
ENOENT if no route was found.
ENOENT if the packet is for another host and the routing is disabled.

References ip_route::address, AF_INET, EAFNOSUPPORT, ERROR_DECLARE, ERROR_PROPAGATE, ip_header::header_checksum, icmp_destination_unreachable_msg(), ICMP_EXC_TTL, ICMP_HOST_UNREACH, ICMP_PARAM_POINTER, icmp_parameter_problem_msg(), icmp_time_exceeded_msg(), IP_CHECKSUM_ZERO, ip_deliver_local(), ip_find_route(), ip_get_destination(), IP_HEADER_CHECKSUM, ip_prepare_icmp_and_get_phone(), ip_release_and_return(), ip_send_route(), IPVERSION, ip_route::netif, packet_get_data(), packet_set_addr(), ip_netif::routing, in_addr::s_addr, sockaddr_in::sin_addr, sockaddr_in::sin_family, ip_header::ttl, and ip_header::version.

Referenced by ip_receive_message().

Here is the call graph for this function:

Here is the caller graph for this function:

int ip_receive_message ( device_id_t  device_id,
packet_t  packet 
)

Processes the received IP packet or the packet queue one by one.

The packet is either passed to another module or released on error.

Parameters:
[in] device_id The source device identifier.
[in,out] packet The received packet.
Returns:
EOK on success and the packet is no longer needed.
EINVAL if the packet is too small to carry the IP packet.
EINVAL if the received address lengths differs from the registered values.
ENOENT if the device is not found in the cache.
ENOENT if the protocol for the device is not found in the cache.
ENOMEM if there is not enough memory left.

References ip_process_packet(), and pq_detach().

Here is the call graph for this function:

int ip_received_error_msg ( int  ip_phone,
device_id_t  device_id,
packet_t  packet,
services_t  target,
services_t  error 
)

Notifies the IP module about the received error notification packet.

Parameters:
[in] ip_phone The IP module phone used for (semi)remote calls.
[in] device_id The device identifier.
[in] packet The received packet or the received packet queue.
[in] target The target internetwork module service to be delivered to.
[in] error The packet error reporting service. Prefixes the received packet.
Returns:
EOK on success.

References generic_received_msg(), NET_IP_RECEIVED_ERROR, and packet_get_id().

Referenced by icmp_process_packet().

Here is the call graph for this function:

Here is the caller graph for this function:

int ip_register ( int  protocol,
services_t  service,
int  phone,
tl_received_msg_t  tl_received_msg 
)

Registers the transport layer protocol.

The traffic of this protocol will be supplied using either the receive function or IPC message.

Parameters:
[in] protocol The transport layer module protocol.
[in] service The transport layer module service.
[in] phone The transport layer module phone.
[in] tl_received_msg The receiving function.
Returns:
EOK on success.
EINVAL if the protocol parameter and/or the service parameter is zero (0).
EINVAL if the phone parameter is not a positive number and the tl_receive_msg is NULL.
ENOMEM if there is not enough memory left.

References free, ip_proto::phone, ip_proto::protocol, ip_globals::protos, ip_globals::protos_lock, ip_proto::received_msg, and ip_proto::service.

int ip_release_and_return ( packet_t  packet,
int  result 
)

Releases the packet and returns the result.

Parameters:
[in] packet The packet queue to be released.
[in] result The result to be returned.
Returns:
The result parameter.

References ip_globals::net_phone, packet_get_id(), and pq_release().

Referenced by ip_deliver_local(), ip_fragment_packet(), ip_prepare_icmp_and_get_phone(), and ip_process_packet().

Here is the call graph for this function:

Here is the caller graph for this function:

int ip_send_msg ( int  ip_phone,
device_id_t  device_id,
packet_t  packet,
services_t  sender,
services_t  error 
)

Sends the packet queue.

The packets may get fragmented if needed.

Parameters:
[in] ip_phone The IP module phone used for (semi)remote calls.
[in] device_id The device identifier.
[in] packet The packet fragments as a~packet queue. All the packets have to have the same destination address.
[in] sender The sending module service.
[in] error The packet error reporting service. Prefixes the received packet.
Returns:
EOK on success.
Other error codes as defined for the generic_send_msg() function.

References generic_send_msg(), NET_IL_SEND, and packet_get_id().

Referenced by icmp_send_packet(), tcp_send_packets(), and udp_sendto_message().

Here is the call graph for this function:

Here is the caller graph for this function:

int ip_send_route ( packet_t  packet,
ip_netif_ref  netif,
ip_route_ref  route,
in_addr_t src,
in_addr_t  dest,
services_t  error 
)

Sends the packet or the packet queue via the specified route.

The ICMP_HOST_UNREACH error notification may be sent if route hardware destination address is found.

Parameters:
[in,out] packet The packet to be sent.
[in] netif The target network interface.
[in] route The target route.
[in] src The source address.
[in] dest The destination address.
[in] error The error module service.
Returns:
EOK on success.
Other error codes as defined for the arp_translate_req() function.
Other error codes as defined for the ip_prepare_packet() function.

References packet_dimension::addr_len, ip_route::address, ip_netif::arp, arp_translate_req(), packet_dimension::content, CONVERT_SIZE, ip_netif::device_id, ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, free, ip_route::gateway, icmp_destination_unreachable_msg(), ICMP_HOST_UNREACH, ip_prepare_icmp_and_get_phone(), ip_prepare_packet(), ip_split_packet(), measured_string::length, ip_globals::net_phone, nil_send_msg, ip_netif::packet_dimension, packet_get_id(), ip_netif::phone, module_struct::phone, pq_release(), packet_dimension::prefix, in_addr::s_addr, packet_dimension::suffix, and measured_string::value.

Referenced by ip_process_packet().

Here is the call graph for this function:

Here is the caller graph for this function:

int ip_set_gateway_req ( int  ip_phone,
device_id_t  device_id,
in_addr_t  gateway 
)

Sets the default gateway.

This gateway is used if no other route is found.

Parameters:
[in] ip_phone The IP module phone used for (semi)remote calls.
[in] device_id The device identifier.
[in] gateway The default gateway.

References NET_IP_SET_GATEWAY, and in_addr::s_addr.

packet_t ip_split_packet ( packet_t  packet,
size_t  prefix,
size_t  content,
size_t  suffix,
socklen_t  addr_len,
services_t  error 
)

Checks the packet queue lengths and fragments the packets if needed.

The ICMP_FRAG_NEEDED error notification may be sent if the packet needs to be fragmented and the fragmentation is not allowed.

Parameters:
[in,out] packet The packet or the packet queue to be checked.
[in] prefix The minimum prefix size.
[in] content The maximum content size.
[in] suffix The minimum suffix size.
[in] addr_len The minimum address length.
[in] error The error module service.
Returns:
The packet or the packet queue of the allowed length.
NULL if there are no packets left.

References icmp_destination_unreachable_msg(), ICMP_FRAG_NEEDED, ip_fragment_packet(), ip_prepare_icmp_and_get_phone(), ip_globals::net_phone, packet_get_data_length(), packet_get_id(), pq_detach(), pq_next(), and pq_release().

Referenced by ip_send_route().

Here is the call graph for this function:

Here is the caller graph for this function:

int module_message ( ipc_callid_t  callid,
ipc_call_t *  call,
ipc_call_t *  answer,
int *  answer_count 
)

Processes the IP message.

Parameters:
[in] callid The message identifier.
[in] call The message parameters.
[out] answer The message answer parameters.
[out] answer_count The last parameter for the actual answer in the answer parameter.
Returns:
EOK on success.
Other error codes as defined for the ip_message() function.

References ip_message().

Here is the call graph for this function:

void module_print_name ( void   ) 

Prints the module name.

See also:
NAME

References NAME.

int module_start ( async_client_conn_t  client_connection  ) 

Starts the IP module.

Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop.

Parameters:
[in] client_connection The client connection processing function. The module skeleton propagates its own one.
Returns:
EOK on successful module termination.
Other error codes as defined for the ip_initialize() function.
Other error codes as defined for the REGISTER_ME() macro function.

References ERROR_CODE, ERROR_DECLARE, ERROR_OCCURRED, ERROR_PROPAGATE, ip_initialize(), net_connect_module(), ip_globals::net_phone, pm_destroy(), pm_init(), and REGISTER_ME.

Here is the call graph for this function:


Variable Documentation

IP module global data.

IP global data.

IP module global data.


Generated on Thu Mar 11 20:47:01 2010 for Networking and TCP/IP stack for HelenOS system by  doxygen 1.6.1