ip.h
net/arch.h
net/def.h
net/pbuf.h
net/ipv4/ip_addr.h
net/netif.h
net/err.h
src/sys/include/net/api.h
src/sys/include/net/api_msg.h
src/sys/include/net/tcp.h
src/sys/include/net/udp.h
src/sys/net/api/tcpip.c
src/sys/net/netif/arp.c
src/sys/net/netif/loopif.c
src/sys/net/netif/tcpdump.c
src/sys/include/net/ipv4/ip.h
arch/lib.h
net/netif.h
arch/cpu.h
ubixos/types.h
sys/_types.h
net/arch.h
net/lwipopts.h
net/def.h
net/ipv4/ip_addr.h
net/err.h
net/opt.h
net/pbuf.h
net/debug.h
net/ipv4/inet.h
arch/cc.h
src/sys/net/net/udpecho.c
src/sys/include/net/ipv4/ip.h
src/sys/net/netif/tcpdump.c
src/sys/net/netif/loopif.c
src/sys/include/net/udp.h
src/sys/include/net/tcp.h
src/sys/net/netif/arp.c
src/sys/net/net/bot.c
src/sys/net/api/tcpip.c
src/sys/include/net/tcpip.h
src/sys/include/net/api_msg.h
src/sys/net/net/shell.c
src/sys/net/api/api_lib.c
src/sys/net/net/init.c
src/sys/include/net/api.h
src/sys/net/api/sockets.c
src/sys/net/api/api_msg.c
ip_hdr
IP_DF
0x4000
IP_HDRINCL
NULL
IP_HLEN
20
IP_MF
0x2000
IP_OFFMASK
0x1fff
IP_PROTO_ICMP
1
IP_PROTO_TCP
6
IP_PROTO_UDP
17
IP_PROTO_UDPLITE
170
IP_RF
0x8000
IPH_CHKSUM
hdr
((hdr)->_chksum)
IPH_CHKSUM_SET
hdr
chksum
(hdr)->_chksum = (chksum)
IPH_HL
hdr
((NTOHS((hdr)->_v_hl_tos) >> 8) & 0x0f)
IPH_ID
hdr
((hdr)->_id)
IPH_ID_SET
hdr
id
(hdr)->_id = (id)
IPH_LEN
hdr
((hdr)->_len)
IPH_LEN_SET
hdr
len
(hdr)->_len = (len)
IPH_OFFSET
hdr
((hdr)->_offset)
IPH_OFFSET_SET
hdr
off
(hdr)->_offset = (off)
IPH_PROTO
hdr
(NTOHS((hdr)->_ttl_proto) & 0xff)
IPH_PROTO_SET
hdr
proto
(hdr)->_ttl_proto = HTONS((proto) | (IPH_TTL(hdr) << 8))
IPH_TOS
hdr
HTONS((NTOHS((hdr)->_v_hl_tos) & 0xff))
IPH_TTL
hdr
(NTOHS((hdr)->_ttl_proto) >> 8)
IPH_TTL_SET
hdr
ttl
(hdr)->_ttl_proto = HTONS(IPH_PROTO(hdr) | ((ttl) << 8))
IPH_V
hdr
(NTOHS((hdr)->_v_hl_tos) >> 12)
IPH_VHLTOS_SET
hdr
v
hl
tos
(hdr)->_v_hl_tos = HTONS(((v) << 12) | ((hl) << 8) | (tos))
void void ip_init (void) ip_init void tcpip_thread
err_t err_t ip_input (struct pbuf *p, struct netif *inp) ip_input struct pbuf * p struct netif * inp tcpip_thread
uInt8 uInt8 ip_lookup (void *header, struct netif *inp) ip_lookup void * header struct netif * inp
err_t err_t ip_output (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, uInt8 ttl, uInt8 proto) ip_output struct pbuf * p struct ip_addr * src struct ip_addr * dest uInt8 ttl uInt8 proto
err_t err_t ip_output_if (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, uInt8 ttl, uInt8 proto, struct netif *netif) ip_output_if struct pbuf * p struct ip_addr * src struct ip_addr * dest uInt8 ttl uInt8 proto struct netif * netif
netif * struct netif* ip_route (struct ip_addr *dest) ip_route struct ip_addr * dest
ip_hdr struct ip_hdr PACK_STRUCT_STRUCT PACK_STRUCT_STRUCT

    /*
    *Copyright(c)2001,SwedishInstituteofComputerScience.
    *Allrightsreserved.
    *
    *Redistributionanduseinsourceandbinaryforms,withorwithout
    *modification,arepermittedprovidedthatthefollowingconditions
    *aremet:
    *1.Redistributionsofsourcecodemustretaintheabovecopyright
    *notice,thislistofconditionsandthefollowingdisclaimer.
    *2.Redistributionsinbinaryformmustreproducetheabovecopyright
    *notice,thislistofconditionsandthefollowingdisclaimerinthe
    *documentationand/orothermaterialsprovidedwiththedistribution.
    *3.NeitherthenameoftheInstitutenorthenamesofitscontributors
    *maybeusedtoendorseorpromoteproductsderivedfromthissoftware
    *withoutspecificpriorwrittenpermission.
    *
    *THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND
    *ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE
    *IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE
    *AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE
    *FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL
    *DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS
    *ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION)
    *HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT
    *LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY
    *OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF
    *SUCHDAMAGE.
    *
    *ThisfileispartofthelwIPTCP/IPstack.
    *
    *Author:AdamDunkels<adam@sics.se>
    *
    *$Id: ipv4_2ip_8h.xml 88 2016-01-12 00:11:29Z reddawg $
    */
    #ifndef__LWIP_IP_H__
    #define__LWIP_IP_H__

    #include"net/arch.h"

    #include"net/def.h"
    #include"net/pbuf.h"
    #include"net/ipv4/ip_addr.h"
    #include"net/netif.h"

    #include"net/err.h"

    voidip_init(void);
    uInt8ip_lookup(void*header,structnetif*inp);
    structnetif*ip_route(structip_addr*dest);
    err_tip_input(structpbuf*p,structnetif*inp);
    err_tip_output(structpbuf*p,structip_addr*src,structip_addr*dest,
    uInt8ttl,uInt8proto);
    err_tip_output_if(structpbuf*p,structip_addr*src,structip_addr*dest,
    uInt8ttl,uInt8proto,
    structnetif*netif);

    #defineIP_HLEN20

    #defineIP_PROTO_ICMP1
    #defineIP_PROTO_UDP17
    #defineIP_PROTO_UDPLITE170
    #defineIP_PROTO_TCP6

    /*Thisispassedasthedestinationaddresstoip_output_if(not
    toip_output),meaningthatanIPheaderalreadyisconstructed
    inthepbuf.ThisisusedwhenTCPretransmits.*/
    #ifdefIP_HDRINCL
    #undefIP_HDRINCL
    #endif/*IP_HDRINCL*/
    #defineIP_HDRINCLNULL

    structip_hdr{
    /*version/headerlength/typeofservice*/
    PACK_STRUCT_FIELD(uInt16_v_hl_tos);
    /*totallength*/
    PACK_STRUCT_FIELD(uInt16_len);
    /*identification*/
    PACK_STRUCT_FIELD(uInt16_id);
    /*fragmentoffsetfield*/
    PACK_STRUCT_FIELD(uInt16_offset);
    #defineIP_RF0x8000/*reservedfragmentflag*/
    #defineIP_DF0x4000/*dontfragmentflag*/
    #defineIP_MF0x2000/*morefragmentsflag*/
    #defineIP_OFFMASK0x1fff/*maskforfragmentingbits*/
    /*timetolive/protocol*/
    PACK_STRUCT_FIELD(uInt16_ttl_proto);
    /*checksum*/
    PACK_STRUCT_FIELD(uInt16_chksum);
    /*sourceanddestinationIPaddresses*/
    PACK_STRUCT_FIELD(structip_addrsrc);
    PACK_STRUCT_FIELD(structip_addrdest);
    }PACK_STRUCT_STRUCT;

    #defineIPH_V(hdr)(NTOHS((hdr)->_v_hl_tos)>>12)
    #defineIPH_HL(hdr)((NTOHS((hdr)->_v_hl_tos)>>8)&0x0f)
    #defineIPH_TOS(hdr)HTONS((NTOHS((hdr)->_v_hl_tos)&0xff))
    #defineIPH_LEN(hdr)((hdr)->_len)
    #defineIPH_ID(hdr)((hdr)->_id)
    #defineIPH_OFFSET(hdr)((hdr)->_offset)
    #defineIPH_TTL(hdr)(NTOHS((hdr)->_ttl_proto)>>8)
    #defineIPH_PROTO(hdr)(NTOHS((hdr)->_ttl_proto)&0xff)
    #defineIPH_CHKSUM(hdr)((hdr)->_chksum)

    #defineIPH_VHLTOS_SET(hdr,v,hl,tos)(hdr)->_v_hl_tos=HTONS(((v)<<12)|((hl)<<8)|(tos))
    #defineIPH_LEN_SET(hdr,len)(hdr)->_len=(len)
    #defineIPH_ID_SET(hdr,id)(hdr)->_id=(id)
    #defineIPH_OFFSET_SET(hdr,off)(hdr)->_offset=(off)
    #defineIPH_TTL_SET(hdr,ttl)(hdr)->_ttl_proto=HTONS(IPH_PROTO(hdr)|((ttl)<<8))
    #defineIPH_PROTO_SET(hdr,proto)(hdr)->_ttl_proto=HTONS((proto)|(IPH_TTL(hdr)<<8))
    #defineIPH_CHKSUM_SET(hdr,chksum)(hdr)->_chksum=(chksum)

    #ifIP_DEBUG
    voidip_debug_print(structpbuf*p);
    #endif/*IP_DEBUG*/

    #endif/*__LWIP_IP_H__*/