Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

SRC/pcsed.h File Reference


Detailed Description

Link-layer (DIX Ethernet, Token-Ring, ARCnet, FDDI and PPP/SLIP) Interface.

Definition in file pcsed.h.

Go to the source code of this file.

Data Structures

struct  eth_Header
struct  eth_Packet
struct  vlan_Header
struct  vlan_Packet
struct  tok_Header
struct  tok_Packet
struct  llc_Header
struct  fddi_Header
struct  fddi_Packet
struct  arcnet_Header
struct  arcnet_Packet
union  link_Packet
struct  _eth_last_info

Typedefs

typedef eth_Header eth_Header
typedef eth_Packet eth_Packet
typedef vlan_Header vlan_Header
typedef vlan_Packet vlan_Packet
typedef tok_Header tok_Header
typedef tok_Packet tok_Packet
typedef llc_Header llc_Header
typedef fddi_Header fddi_Header
typedef fddi_Packet fddi_Packet
typedef arcnet_Header arcnet_Header
typedef arcnet_Packet arcnet_Packet
typedef link_Packet link_Packet

Functions

W32_FUNC int _eth_init (void)
 Initialize the network driver interface.
W32_FUNC void _eth_release (void)
 Release the hardware driver.
W32_FUNC int _eth_send (WORD len, const void *sock, const char *file, unsigned line)
 _eth_send() does the actual transmission once we are complete with filling the buffer.
W32_FUNC int _eth_set_addr (const void *addr)
 Sets a new MAC address for our interface.
W32_FUNC void * _eth_formatpacket (const void *mac_dest, WORD mac_type)
 _eth_format_packet() places the next packet to be transmitted into the above link-layer output packet.
W32_FUNC void _eth_free (const void *pkt)
 Free an input buffer once it is no longer needed.
W32_FUNC void * _eth_arrived (WORD *type, BOOL *brdcast)
 Poll for arrival of new packets (IP/ARP/RARP/PPPoE protocol).
W32_FUNC BYTE _eth_get_hwtype (BYTE *hwtype, BYTE *hwlen)
 Fill in hardware address type/length for BOOTP/DHCP packets.
W32_FUNC BOOL _eth_join_mcast_group (const struct MultiCast *mc)
 Joins a multicast group (at the physical layer).
W32_FUNC BOOL _eth_leave_mcast_group (const struct MultiCast *mc)
 Leaves a multicast group (at the physical layer).
void * _eth_mac_hdr (const in_Header *ip) ATTR_NORETURN()
 Return pointer to MAC header start address of an IP packet.
void * _eth_mac_dst (const in_Header *ip) ATTR_NORETURN()
 Return pointer to MAC destination address of an IP packet.
void * _eth_mac_src (const in_Header *ip) ATTR_NORETURN()
 Return pointer to MAC source address of an IP packet.
WORD _eth_mac_typ (const in_Header *ip) ATTR_NORETURN()
 Return value of protocol-type given an IP packet.

Variables

_eth_last_info _eth_last
 Sizes and timestamps of last packet recv/sent.
BOOL _ip_recursion
 avoid recursion in arp_resolve()
BOOL _eth_is_init
 we are initialised
BOOL _eth_ndis3pkt
 for DOS-programs only
BOOL _eth_SwsVpkt
 for DOS *and* Win32 programs
BOOL _eth_airpcap
 for Win32 using the AirPcap adapter
BYTE _eth_mac_len
 Size of a MAC address.
const char * _eth_not_init
W32_DATA mac_address _eth_addr
W32_DATA mac_address _eth_real_addr
W32_DATA mac_address _eth_loop_addr
W32_DATA mac_address _eth_brdcast
W32_DATA void *(* _eth_recv_hook )(WORD *type)
W32_DATA int(* _eth_recv_peek )(void *mac_buf)
W32_DATA int(* _eth_xmit_hook )(const void *mac_buf, unsigned len)


Function Documentation

W32_FUNC void* _eth_arrived WORD type_ptr,
BOOL *  broadcast
 

Poll for arrival of new packets (IP/ARP/RARP/PPPoE protocol).

Sets protocol-type of packet received in 'type'.

For Ethernet/TokenRing-type drivers:

Return values:
Pointer past the MAC-header to the IP/ARP/RARP protocol header. Also check for link-layer broadcast.
For PPP/SLIP-type drivers (no MAC-headers):
Return values:
Pointer to the IP-packet itself. IP-protocol is assumed. Can never be link-layer broadcast.

<

Todo:
push back packet, else it's lost
Definition at line 1016 of file pcsed.c.

W32_FUNC void* _eth_formatpacket const void *  mac_dest,
WORD  eth_type
 

_eth_format_packet() places the next packet to be transmitted into the above link-layer output packet.

Returns:
address of higher-level protocol (IP/RARP/RARP) header.
Definition at line 131 of file pcsed.c.

W32_FUNC BYTE _eth_get_hwtype BYTE hwtype,
BYTE hwlen
 

Fill in hardware address type/length for BOOTP/DHCP packets.

Also used for ARP/RARP packets. Should never be called for PPP/SLIP. Definition at line 740 of file pcsed.c.

W32_FUNC int _eth_init void   ) 
 

Initialize the network driver interface.

Returns:
0 okay.

error-code otherwise.

Definition at line 648 of file pcsed.c.

W32_FUNC BOOL _eth_join_mcast_group const struct MultiCast mc  ) 
 

Joins a multicast group (at the physical layer).

Return values:
1 The group was joined successfully.
0 Attempt failed.
Definition at line 1238 of file pcsed.c.

References _pkt_errno, _pkt_rxmode, eth_address, MultiCast::ethaddr, pkt_get_multicast_list(), pkt_set_multicast_list(), pkt_set_rcv_mode(), RXMODE_MULTICAST1, RXMODE_MULTICAST2, and RXMODE_PROMISCOUS.

W32_FUNC BOOL _eth_leave_mcast_group const struct MultiCast mc  ) 
 

Leaves a multicast group (at the physical layer).

Return values:
1 The group was left successfully.
0 Attempt failed.
Definition at line 1314 of file pcsed.c.

References _pkt_errno, _pkt_rxmode, eth_address, MultiCast::ethaddr, pkt_get_multicast_list(), pkt_set_multicast_list(), pkt_set_rcv_mode(), and RXMODE_MULTICAST2.

W32_FUNC int _eth_send WORD  len,
const void *  sock,
const char *  file,
unsigned  line
 

_eth_send() does the actual transmission once we are complete with filling the buffer.

Do any last minute patches here, like fix the size. Send to "loopback" device if it's IP and destination matches loopback network (127.x.x.x.).

Return length of network-layer packet (not length of link-layer packet). Definition at line 302 of file pcsed.c.


Generated on Wed Aug 4 08:55:57 2010 for Watt-32 tcp/ip by doxygen 1.3.8