X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FIPStack%2Fipstack.h;h=95f93c478181bd444441c30d01db1fd3ad2c09d3;hb=351dd3b194833c923bad0292e9019320fb2a41fa;hp=8b846ab3eb9325531d01f22b93b039cb71923ac7;hpb=6c5a509b5e14e097ca537c539bc9babe3b8f0c4c;p=tpg%2Facess2.git diff --git a/Modules/IPStack/ipstack.h b/Modules/IPStack/ipstack.h index 8b846ab3..95f93c47 100644 --- a/Modules/IPStack/ipstack.h +++ b/Modules/IPStack/ipstack.h @@ -5,7 +5,7 @@ #ifndef _IPSTACK_H_ #define _IPSTACK_H_ -#include +#include #include typedef union uIPv4 tIPv4; @@ -13,32 +13,34 @@ typedef union uIPv6 tIPv6; typedef struct sMacAddr tMacAddr; typedef struct sAdapter tAdapter; typedef struct sInterface tInterface; +typedef struct sSocketFile tSocketFile; typedef void (*tIPCallback)(tInterface *Interface, void *Address, int Length, void *Buffer); union uIPv4 { Uint32 L; Uint8 B[4]; -}; +} __attribute__((packed)); union uIPv6 { Uint32 L[4]; Uint8 B[16]; -}; +} __attribute__((packed)); struct sMacAddr { Uint8 B[6]; -}; +} __attribute__((packed)); struct sInterface { struct sInterface *Next; tVFS_Node Node; tAdapter *Adapter; - int Type; // 4 for IPv4 and 6 for IPv6 + int TimeoutDelay; // Time in miliseconds before a connection times out + int Type; // 0 for disabled, 4 for IPv4 and 6 for IPv6 union { struct { tIPv6 Address; - int SubnetBits; + int SubnetBits; //Should this be outside the union? } IP6; struct { @@ -54,12 +56,24 @@ struct sInterface { */ struct sAdapter { struct sAdapter *Next; - char *Device; + int DeviceFD; + int NRef; tMacAddr MacAddr; + int DeviceLen; + char Device[]; +}; + +/** + * \brief Describes a socket file definition + */ +struct sSocketFile +{ + struct sSocketFile *Next; + const char *Name; - tInterface *Interfaces; + tVFS_Node *(*Init)(tInterface *Interface); }; static const tMacAddr cMAC_BROADCAST = {{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}}; @@ -78,6 +92,8 @@ static const tMacAddr cMAC_BROADCAST = {{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}}; #define htonl(in) BigEndian32(in) #define ntonb(v) (v) #define ntohs(in) BigEndian16(in) -#define ntohl(in) BigEndian16(in) +#define ntohl(in) BigEndian32(in) + +extern int IPStack_AddFile(tSocketFile *File); #endif