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

SRC/pcpkt.h File Reference


Detailed Description

Definition in file pcpkt.h.

Go to the source code of this file.

Data Structures

struct  PktStats
struct  PktParameters
struct  cstate
struct  slcompress
struct  async_iocb
struct  pkt_info
 Placeholder for vital data accessed by capture thread. More...

Enumerations

enum  ReceiveModes {
  RXMODE_OFF = 1,
  RXMODE_DIRECT = 2,
  RXMODE_BROADCAST = 3,
  RXMODE_MULTICAST1 = 4,
  RXMODE_MULTICAST2 = 5,
  RXMODE_PROMISCOUS = 6
}

Functions

W32_FUNC const char * pkt_strerror (int code)
 Return textual error representing error-code.
W32_FUNC DWORD pkt_dropped (void)
 Return number of packets dropped.
int pkt_eth_init (mac_address *eth)
 Initialise Packet driver interface.
int pkt_release (void)
int pkt_release_handle (WORD)
 Release the allocated protocol handle.
int pkt_reset_handle (WORD handle)
 Reset the driver-state associated with handle.
int pkt_send (const void *tx, int length)
 Send a link-layer frame.
int pkt_buf_wipe (void)
 Clear the receive queue.
void pkt_free_pkt (const void *pkt)
 Release a packet from the receive queue.
int pkt_waiting (void)
 Return number of packets waiting in queue.
int pkt_set_addr (const void *eth)
 Set a new MAC source address.
int pkt_get_addr (mac_address *eth)
 Return the MAC address.
int pkt_get_mtu (void)
 Return PKTDRVR maximum-transmit-units (MTU).
int pkt_get_drvr_ver (WORD *major, WORD *minor)
 Return version of PKTDRVR.
int pkt_get_api_ver (DWORD *ver)
 Return version of spec.
int pkt_get_vector (void)
 Return PKTDRVR vector.
int pkt_set_rcv_mode (int mode)
 Sets the receive mode of the interface.
int pkt_get_rcv_mode (void)
 Gets the receive mode of the interface (can never be mode 0).
int pkt_get_multicast_list (mac_address *listbuf, int *len)
 Gets the current list of multicast addresses from the PKTDRVR.
int pkt_set_multicast_list (const void *listbuf, int len)
 Sets the list of multicast addresses for which the PKTDRVR is responsible.
int pkt_get_params (struct PktParameters *params)
 Get PKTDRVR parameters (MTU, version etc.).
int pkt_get_stats (struct PktStats *stats, struct PktStats *total)
 Get PKTDRVR statistics.
int pkt_get_vjstats (struct slcompress *vjstats)
int pkt_get_cstate (struct cstate *cs, WORD cstate_ofs)
void * pkt_tx_buf (void)
 Return address of DOS memory Tx-buffer.
int pkt_append_recv (const void *tx, unsigned len)
int pkt_buffers_used (void)
int pkt_test_upcall (void)
void pkt_dump_real_mem (void)
pkt_rx_element * pkt_poll_recv (void)
void __dj_movedata (void)
void __movedata (unsigned src_sel, unsigned src_ofs, unsigned dst_sel, unsigned dst_ofs, size_t bytes)

Variables

W32_DATA WORD _pktdevclass
 PKTDRVR class.
W32_DATA WORD _pkt_ip_ofs
 Offset from MAC-header to IP-header.
W32_DATA BOOL _pktserial
 Driver is a serial (SLIP/PPP) driver.
W32_DATA char _pktdrvrname []
 Name of PKDRVR.
W32_DATA int _pkt_rxmode
 Current PKTDRVR/WinPcap Rx-mode.
W32_DATA int _pkt_rxmode0
 Startup receive mode.
W32_DATA int _pkt_forced_rxmode
 Forced Rx-mode via WATTCP.CFG.
W32_DATA int _pkt_errno
 Last PKTDRVR error code.
BYTE _pktdevlevel
 Device level.
pkt_info_pkt_inf
 module data that will be locked


Enumeration Type Documentation

enum ReceiveModes
 

Enumeration values:
RXMODE_OFF  turn off receiver
RXMODE_DIRECT  receive only to this interface
RXMODE_BROADCAST  DIRECT + broadcast packets.
RXMODE_MULTICAST1  BROADCAST + limited multicast.
RXMODE_MULTICAST2  BROADCAST + all multicast.
RXMODE_PROMISCOUS  receive all packets on network
Definition at line 132 of file pcpkt.h.


Function Documentation

int pkt_eth_init mac_address *  mac_addr  ) 
 

Initialise Packet driver interface.

<

Todo:
Support Win-9x/ME/CE too
Definition at line 1419 of file pcpkt.c.

void pkt_free_pkt const void *  pkt  ) 
 

Release a packet from the receive queue.

If USE_FAST_PKT, pkt has already been free'd. Just update drop count. Definition at line 1319 of file pcpkt.c.

int pkt_get_api_ver DWORD ver  ) 
 

Return version of spec.

this PKTDRVR conforms to.

Return values:
-1 on error. Return major version in upper 8 bit, minor in lower.
Definition at line 507 of file pcpkt.c.

int pkt_get_mtu void   ) 
 

Return PKTDRVR maximum-transmit-units (MTU).

Note:
This includes length of MAC-header.
Definition at line 477 of file pcpkt.c.

int pkt_get_multicast_list mac_address *  listbuf,
int *  lenp
 

Gets the current list of multicast addresses from the PKTDRVR.

  • listbuf is the buffer into which the list is placed
  • len on input: length of listbuf on output: length of list returned
Return values:
0 upon error - _pkt_errno is set
1 if retrieval was successful,
Definition at line 2006 of file pcpkt.c.

int pkt_get_rcv_mode void   ) 
 

Gets the receive mode of the interface (can never be mode 0).

Return values:
!0 Okay - _pkt_errno is 0, _pkt_rxmode and retval is current mode.
0 Error - _pkt_errno is set.
_pkt_rxmode is one of the following modes: (upon successful return)
  • 1 - turn off receiver
  • 2 - receive only packets sent to this interface
  • 3 - mode 2 plus broadcast packets (default)
  • 4 - mode 3 plus limited multicast packets
  • 5 - mode 3 plus all multicast packets
  • 6 - all packets (a.k.a promiscuous mode)
Definition at line 1968 of file pcpkt.c.

int pkt_get_stats struct PktStats *  stats,
struct PktStats *  total
 

Get PKTDRVR statistics.

Return both 'stats' for current session and 'total' statistics since driver loaded. Definition at line 1213 of file pcpkt.c.

int pkt_release void   ) 
 

Todo:
We might be called between 1st and 2nd packet-driver upcall. Need to wait for 2nd upcall to finish or else freeing the RMCB too early could cause a crash or a stuck PKTDRVR.
Definition at line 808 of file pcpkt.c.

int pkt_send const void *  tx,
int  length
 

Send a link-layer frame.

For PPP/SLIP 'tx' contains no MAC-header. For EtherNet, Token-Ring, ARCNET and FDDI, 'tx' contains the complete frame.

Todo:
Change this so that we doesn't retry if the driver was stuck for "too long". I've seen drivers using approx. 100 msec on each iteration below. Retrying if the driver is stuck is not worth the time.
Definition at line 1060 of file pcpkt.c.

int pkt_set_multicast_list const void *  listbuf,
int  len
 

Sets the list of multicast addresses for which the PKTDRVR is responsible.

  • listbuf is the buffer containing the list
  • len is the length of listbuf
Return values:
0 upon error - _pkt_errno is set
1 if set was successful
Definition at line 2053 of file pcpkt.c.

int pkt_set_rcv_mode int  mode  ) 
 

Sets the receive mode of the interface.

mode is one of the following modes:

  • 1 - turn off receiver
  • 2 - receive only packets sent to this interface
  • 3 - mode 2 plus broadcast packets <default>
  • 4 - mode 3 plus limited multicast packets
  • 5 - mode 3 plus all multicast packets
  • 6 - all packets (AKA promiscuous mode)

Return values:
0 - upon error - _pkt_errno is set
1 - if the mode was set successfully
Definition at line 1924 of file pcpkt.c.

void* pkt_tx_buf void   ) 
 

Return address of DOS memory Tx-buffer.

For DOS4GW/X32VM (and djgpp with near-ptrs) targets, return near address of transmit buffer located in DOS memory. Definition at line 290 of file pcpkt.c.


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