NetBurner 3.5.0
PDF Version
 
ip.h File Reference

NetBurner IP Definitions. More...

#include <predef.h>
#include "nettypes.h"
#include "buffers.h"

Go to the source code of this file.

Classes

struct  _IpHeaderIPv4
 IP Header (IPv4) More...
 
struct  IPPKT
 Internal IPv4 Header. More...
 
struct  UDPPKT
 Internal UDP Header. More...
 
struct  PsudeoHeader
 UDP IPv4 Pseudo-header segment (bits 0 through 95) More...
 

Macros

#define ICMP_PING_DATA_SIZE   (32)
 size for ICMP echo request and replay ("ping")
 
IP Version

Uncomment for debugging

#define IP_VERSION_MASK   (0xF0)
 Version Mask.
 
#define IP_VERSION_IPv4   (0x40)
 IPv4.
 
#define IP_VERSION_IPv6   (0x60)
 IPv6.
 
Header Length
#define IP_HEADER_LENGTH_MASK   (0x0F)
 
#define IP_HEADER_LENGTH_NO_OPTIONS   (0x05)
 
Flags and Fragment Offset
#define IP_FLAGS_MASK   (0xE000)
 
#define IP_FRAGMENT_OFFSET_MASK   (0x1FFF)
 
IP protocol numbers
#define IP_PROTOCOL_ICMP   (0x01)
 
#define IP_PROTOCOL_IGMP   (0x02)
 
#define IP_PROTOCOL_INTERNET   (0x04)
 
#define IP_PROTOCOL_TCP   (0x06)
 
#define IP_PROTOCOL_UDP   (0x11)
 
control message type(s) and code(s)
#define ICMP_TYPE_ECHO_REPLY   (0)
 
#define ICMP_CODE_ECHO_REPLY   (0)
 
#define ICMP_TYPE_DEST_UNREACHABLE   (3)
 
#define ICMP_CODE_PORT_UNREACHABLE   (3)
 
#define ICMP_TYPE_SOURCE_QUENCH   (4)
 
#define ICMP_CODE_SOURCE_QUENCH   (0)
 
#define ICMP_TYPE_REDIRECT_MESSAGE   (5)
 
#define ICMP_TYPE_ECHO_REQUEST   (8)
 
#define ICMP_CODE_ECHO_REQUEST   (0)
 
Well Known Ports
#define IANA_ECHO_PORT   (7)
 
#define IANA_DISCARD_PORT   (9)
 
#define IANA_SSH_PORT   (22)
 
#define IANA_TELNET_PORT   (23)
 
#define IANA_NETBIOS_NAME_SERVICE_PORT   (137)
 

Typedefs

typedef struct _IpHeaderIPv4 IpHeaderIPv4
 IP Header (IPv4)
 

Functions

void IpProcessEthernetPacket (PoolPtr poolPtr, uint16_t packetSizeInBytes)
 IP packet insertion for processing.
 
uint16_t GetSum (puint16_t addr, uint16_t count)
 Checksum.
 
uint16_t GetSum20 (puint32_t addr)
 Checksum.
 
uint16_t GetSumHdr (PsudeoHeader &hdr, puint16_t addr, uint16_t count)
 Checksum using pseudo-header.
 
BOOL IsMyIp4 (IPADDR4 ip, int ifc=-1)
 Is this my IP address?
 
IPADDR4 GetSrcIp4 (IPADDR4 dst)
 Get source IP address for this destination.
 
IPADDR4 GetSrcIpwIf4 (int ifn, const IPADDR4 dst)
 
BOOL IsMyIp (const IPADDR &ip, int ifc=-1)
 Is this my IP address?
 
IPADDR GetSrcIp (const IPADDR &dst)
 Get source IP address for this destination.
 
IPADDR GetSrcIpwIf (int ifn, const IPADDR &dst)
 Get source IP address for an interface.
 
void SendICMPError (PoolPtr pBadPacket, uint8_t type, uint8_t code)
 Send ICMP error.
 
void FixHeaderAndSend (PoolPtr p, PIPPKT pIp)
 Complete header and send on primary network interface.
 
void FixHeaderAndSendViaInterface (PoolPtr p, PIPPKT pIp, int Interface)
 Complete header and send on an interface.
 
void InitializeStack ()
 Initializes the IP stack.
 
int AddInterface (IPADDR4 addr, IPADDR4 mask, IPADDR4 gateway, int root_if)
 Add an interface with an interface number.
 
Get Packet Functions
WARNING:
If you use these functions on an uninitialized buffer you will get bogus values for the pointer as the header length field in the IP packet is not yet set up!
PIPPKT GetIpPkt (PoolPtr p)
 Get IP Packet pointer from network buffer pool buffer.
 
PIPPKT GetIpPkt (PEFRAME pFrame)
 Get IP packet pointer from pointer to frame.
 
PIPPKT GetIpPkt (PVLEFRAME pFrame)
 Get IP Packet pointer from network buffer pool buffer.
 
PUDPPKT GetUdpPkt (PIPPKT pIp)
 Get UPD packet pointer from IP packet pointer.
 

Variables

Global Data
uint8_t bTTL_Default
 Default number of hops (time to live)
 
uint16_t wArpLifetime
 ARP lifetime in seconds.
 
BOOL bQuietStart
 Quiet start.
 

Detailed Description

NetBurner IP Definitions.