#include <ethsock.h>
Inheritance diagram for PEthSocket:
Information functions | |
enum | MediumTypes { MediumLoop, Medium802_3, MediumWan, MediumUnknown, NumMediumTypes } |
Medium types for the open interface. More... | |
BOOL | EnumInterfaces (PINDEX idx, PString &name) |
BOOL | GetAddress (Address &addr) |
BOOL | GetIpAddress (PIPSocket::Address &addr) |
BOOL | GetIpAddress (PIPSocket::Address &addr, PIPSocket::Address &netMask) |
BOOL | EnumIpAddress (PINDEX idx, PIPSocket::Address &addr, PIPSocket::Address &netMask) |
MediumTypes | GetMedium () |
Filtering functions | |
enum | EthTypes { TypeAll = 3, TypeIP = 0x800, TypeX25 = 0x805, TypeARP = 0x806, TypeAtalk = 0x809B, TypeAARP = 0x80F3, TypeIPX = 0x8137, TypeIPv6 = 0x86DD } |
Type codes for ethernet frames. More... | |
enum | FilterMask { FilterDirected = 0x01, FilterMulticast = 0x02, FilterAllMulticast = 0x04, FilterBroadcast = 0x08, FilterPromiscuous = 0x10 } |
Mask filter bits for GetFilter() function. More... | |
BOOL | GetFilter (unsigned &mask, WORD &type) |
BOOL | SetFilter (unsigned mask, WORD type=TypeAll) |
Public Types | |
Public Member Functions | |
Constructor | |
PEthSocket (PINDEX nReadBuffers=8, PINDEX nWriteBuffers=1, PINDEX size=1514) | |
~PEthSocket () | |
Close the socket. | |
Overrides from class PChannel | |
virtual BOOL | Close () |
virtual BOOL | Read (void *buf, PINDEX len) |
virtual BOOL | Write (const void *buf, PINDEX len) |
Overrides from class PSocket | |
virtual BOOL | Connect (const PString &address) |
virtual BOOL | Listen (unsigned queueSize=5, WORD port=0, Reusability reuse=AddressIsExclusive) |
I/O functions | |
BOOL | ResetAdaptor () |
BOOL | ReadPacket (PBYTEArray &buffer, Address &dest, Address &src, WORD &type, PINDEX &len, BYTE *&payload) |
Protected Member Functions | |
virtual BOOL | OpenSocket () |
virtual const char * | GetProtocolName () const |
Protected Attributes | |
WORD | filterType |
Address | macAddress |
MediumTypes | medium |
unsigned | filterMask |
BOOL | fakeMacHeader |
BOOL | ipppInterface |
|
Type codes for ethernet frames.
|
|
Mask filter bits for GetFilter() function.
|
|
Medium types for the open interface.
|
|
Create a new ethernet packet socket. Some platforms require a set of buffers to be allocated to avoid losing frequent packets.
|
|
Close the socket.
|
|
Close the channel, shutting down the link to the data source.
Reimplemented from PChannel. |
|
Connect a socket to an interface. The first form opens an interface by a name as returned by the EnumInterfaces() function. The second opens the interface that has the specified MAC address.
Reimplemented from PSocket. |
|
Enumerate all the interfaces that are capable of being accessed at the ethernet level. Begin with index 0, and increment until the function returns FALSE. The name string returned can be passed, unchanged, to the Connect() function. Note that the driver does not need to be open for this function to work.
|
|
Enumerate all of the IP addresses and net masks bound to the open interface. This allows all the addresses to be found on multi-homed hosts. Begin with index 0 and increment until the function returns FALSE to enumerate all the addresses.
|
|
Get the low level MAC address of the open interface.
|
|
Get the current filtering criteria for receiving packets. A bit-wise OR of the FilterMask values will filter packets so that they do not appear in the Read() function at all. The type is be the specific frame type to accept. A value of TypeAll may be used to match all frame types.
|
|
Get the prime IP number bound to the open interface. This also returns the net mask associated with the open interface.
|
|
Get the prime IP number bound to the open interface.
|
|
Return the type of the interface.
|
|
This function returns the protocol name for the socket type. Implements PSocket. |
|
This function is illegal and will assert if attempted. You must be connected to an interface using Connect() to do I/O on the socket.
Reimplemented from PSocket. |
|
Implements PSocket. |
|
Low level read from the channel. This function may block until the requested number of characters were read or the read timeout was reached. The GetLastReadCount() function returns the actual number of bytes read. The GetErrorCode() function should be consulted after Read() returns FALSE to determine what caused the failure.
Reimplemented from PSocket. |
|
Read a packet from the interface and parse out the information specified by the parameters. This will automatically adjust for 802.2 and 802.3 ethernet frames.
|
|
Reset the interface. |
|
Set the current filtering criteria for receiving packets. A bit-wise OR of the FilterMask values will filter packets so that they do not appear in the Read() function at all. The type is be the specific frame type to accept. A value of TypeAll may be used to match all frame types. A value of zero for the filter mask is useless and will assert.
|
|
Low level write to the channel. This function will block until the requested number of characters are written or the write timeout is reached. The GetLastWriteCount() function returns the actual number of bytes written. The GetErrorCode() function should be consulted after Write() returns FALSE to determine what caused the failure.
Reimplemented from PChannel. |
|
|
|
|
|
|
|
|
|
|
|
|