11 typedef union uIPv4 tIPv4;
12 typedef union uIPv6 tIPv6;
13 typedef struct sMacAddr tMacAddr;
14 typedef struct sAdapter tAdapter;
15 typedef struct sInterface tInterface;
16 typedef struct sSocketFile tSocketFile;
18 typedef void (*tIPCallback)(tInterface *Interface, void *Address, int Length, void *Buffer);
20 enum eInterfaceTypes {
22 AF_INET4 = 4, // tIPv4
29 } __attribute__((packed));
35 } __attribute__((packed));
39 } __attribute__((packed));
42 struct sInterface *Next;
45 int TimeoutDelay; // Time in miliseconds before a packet times out
46 int Type; // 0 for disabled, 4 for IPv4 and 6 for IPv6
48 //TODO: Remove explicit mentions of IPv4/IPv6 and make more general
52 int SubnetBits; //Should this be outside the union?
64 * \brief Represents a network adapter
67 struct sAdapter *Next;
78 * \brief Describes a socket file definition
82 struct sSocketFile *Next;
85 tVFS_Node *(*Init)(tInterface *Interface);
88 static const tMacAddr cMAC_BROADCAST = {{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}};
90 #define MAC_SET(t,v) memcpy(&(t),&(v),sizeof(tMacAddr))
91 #define IP4_SET(t,v) (t).L = (v).L;
92 #define IP6_SET(t,v) memcpy(&(t),&(v),sizeof(tIPv6))
94 #define MAC_EQU(a,b) (memcmp(&(a),&(b),sizeof(tMacAddr))==0)
95 #define IP4_EQU(a,b) ((a).L==(b).L)
96 #define IP6_EQU(a,b) (memcmp(&(a),&(b),sizeof(tIPv6))==0)
100 #define htons(v) BigEndian16(v)
101 #define htonl(v) BigEndian32(v)
103 #define ntohs(v) BigEndian16(v)
104 #define ntohl(v) BigEndian32(v)
106 extern int IPStack_AddFile(tSocketFile *File);
107 extern int IPStack_GetAddressSize(int AddressType);
108 extern int IPStack_CompareAddress(int AddressType, void *Address1, void *Address2, int CheckBits);