FireSync API
 All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kPacketSocket Class Reference

Description

Represents layer 2 functionality (sending and receiving of raw ethernet frames).

The kPacketSocket class lets you send and receive layer 2 (data link layer) frames. The internal driver buffer is of a fixed size. So if you cannot process the packets fast enough by calling kPacketSocket_Receive as they arrive any incoming frame gets dropped when buffer is full.

Implementation uses pcap library on Windows and Linux. If implementation cannot load the pcap library (e.g. WinPcap driver is not installed on Windows) the constructor will return kERROR_STATE.

Inheritance diagram for kPacketSocket:
Inheritance graph

Public Member Functions

kStatus kPacketSocket_AdapterInfo (kIpAddress ipAddress, kChar *adapterName, kSize capacity, kIpAddress *gateway, k32u *prefixlength, kMacAddress *macAddress)
 Gives extended adapter information for a given Ip address. More...
 
kStatus kPacketSocket_Construct (kPacketSocket *sockt, const kChar *adapterName, k16u *protocols, kSize protocolCount, kAlloc allocator)
 Constructs a kPacketSocket object (non-promiscuous mode). More...
 
kStatus kPacketSocket_ConstructEx (kPacketSocket *sockt, const kChar *adapterName, k16u *protocols, kSize protocolCount, kBool promiscuousMode, kAlloc allocator)
 Constructs a kPacketSocket object with additional options. More...
 
kStatus kPacketSocket_ConstructFromIp (kPacketSocket *sockt, kIpAddress ipAddress, k16u *protocols, kSize protocolCount, kAlloc allocator)
 Constructs a kPacketSocket object from an IP address (non-promiscuous mode). More...
 
kStatus kPacketSocket_ConstructFromIpEx (kPacketSocket *sockt, kIpAddress ipAddress, k16u *protocols, kSize protocolCount, kBool promiscuousMode, kAlloc allocator)
 Constructs a kPacketSocket object from an Ip address with additional options. More...
 
kStatus kPacketSocket_PrintPacket (const kByte *buffer, kSize size, kBool includeData, kString output)
 Fills a string with the source and destination MAC address and hex presentation of the data. More...
 
kStatus kPacketSocket_Receive (kPacketSocket sockt, void *buffer, kSize size, kSize *bytesRead, k64u timeout)
 Reads up to the specified number of bytes from the socket. More...
 
kStatus kPacketSocket_Send (kPacketSocket sockt, const void *buffer, k32s size)
 Sends the specified number of bytes. More...
 

The documentation for this class was generated from the following file: