X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FIPStack%2Fipstack.h;h=e6ded4b170f589e27361f174a3f350f70d3ede22;hb=7758e1bf2e2a1ad35def1eb8cf9aab55d13e05a0;hp=20f645cf1dc6f209536f428ab4896b25af4a1c4a;hpb=d5834686ad14b66420060192445f06bce85db389;p=tpg%2Facess2.git diff --git a/Modules/IPStack/ipstack.h b/Modules/IPStack/ipstack.h index 20f645cf..e6ded4b1 100644 --- a/Modules/IPStack/ipstack.h +++ b/Modules/IPStack/ipstack.h @@ -39,39 +39,48 @@ struct sMacAddr { } __attribute__((packed)); struct sInterface { - struct sInterface *Next; - tVFS_Node Node; - tAdapter *Adapter; - int TimeoutDelay; // Time in miliseconds before a packet times out - int Type; // 0 for disabled, 4 for IPv4 and 6 for IPv6 + struct sInterface *Next; //!< Next interface in list - //TODO: Remove explicit mentions of IPv4/IPv6 and make more general - union { - struct { - tIPv6 Address; - int SubnetBits; //Should this be outside the union? - } IP6; - - struct { - tIPv4 Address; - tIPv4 Gateway; - int SubnetBits; - } IP4; - }; + tVFS_Node Node; //!< Node to use the interface + + tAdapter *Adapter; //!< Adapter the interface is associated with + int TimeoutDelay; //!< Time in miliseconds before a packet times out + int Type; //!< Interface type, see ::eInterfaceTypes + + void *Address; //!< IP address (stored after the Name) + int SubnetBits; //!< Number of bits that denote the address network + + char Name[]; }; +/** + * \brief Route definition structure + */ +typedef struct sRoute { + struct sRoute *Next; + + tVFS_Node Node; //!< Node for route manipulation + + tInterface *Interface; //!< Interface for this route + int AddressType; //!< 0: Invalid, 4: IPv4, 6: IPv4 + void *Network; //!< Network - Pointer to tIPv4/tIPv6/... at end of structure + int SubnetBits; //!< Number of bits in \a Network that are valid + void *NextHop; //!< Next Hop address - Pointer to tIPv4/tIPv6/... at end of structure + int Metric; //!< Route priority +} tRoute; + /** * \brief Represents a network adapter */ struct sAdapter { struct sAdapter *Next; - int DeviceFD; - int NRef; + int DeviceFD; //!< File descriptor of the device + int NRef; //!< Number of times it's been referenced - tMacAddr MacAddr; - int DeviceLen; - char Device[]; + tMacAddr MacAddr; //!< Physical address of the adapter + int DeviceLen; //!< Device name length + char Device[]; //!< Device name }; /** @@ -105,5 +114,9 @@ static const tMacAddr cMAC_BROADCAST = {{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}}; extern int IPStack_AddFile(tSocketFile *File); extern int IPStack_GetAddressSize(int AddressType); +extern int IPStack_CompareAddress(int AddressType, void *Address1, void *Address2, int CheckBits); +extern const char *IPStack_PrintAddress(int AddressType, void *Address); + +extern tRoute *IPStack_FindRoute(int AddressType, tInterface *Interface, void *Address); #endif