26#ifndef _ULTIBO_NETWORK_H
27#define _ULTIBO_NETWORK_H
38#define NETWORK_NAME_PREFIX "Network"
41#define NETWORK_TYPE_NONE 0
42#define NETWORK_TYPE_ETHERNET 1
43#define NETWORK_TYPE_TOKENRING 2
44#define NETWORK_TYPE_80211 3
46#define NETWORK_TYPE_MAX 3
49#define NETWORK_STATE_CLOSED 0
50#define NETWORK_STATE_CLOSING 1
51#define NETWORK_STATE_OPENING 2
52#define NETWORK_STATE_OPEN 3
54#define NETWORK_STATE_MAX 3
57#define NETWORK_STATUS_DOWN 0
58#define NETWORK_STATUS_UP 1
60#define NETWORK_STATUS_MAX 1
63#define NETWORK_FLAG_NONE 0x00000000
64#define NETWORK_FLAG_RX_BUFFER 0x00000001
65#define NETWORK_FLAG_TX_BUFFER 0x00000002
66#define NETWORK_FLAG_RX_MULTIPACKET 0x00000004
67#define NETWORK_FLAG_TX_MULTIPACKET 0x00000008
70#define NETWORK_CONTROL_CLEAR_STATS 1
71#define NETWORK_CONTROL_SET_MAC 2
72#define NETWORK_CONTROL_GET_MAC 3
73#define NETWORK_CONTROL_SET_LOOPBACK 4
74#define NETWORK_CONTROL_RESET 5
75#define NETWORK_CONTROL_DISABLE 6
76#define NETWORK_CONTROL_GET_HARDWARE 7
77#define NETWORK_CONTROL_GET_BROADCAST 8
78#define NETWORK_CONTROL_GET_MTU 9
79#define NETWORK_CONTROL_GET_HEADERLEN 10
80#define NETWORK_CONTROL_GET_LINK 11
81#define NETWORK_CONTROL_GET_SPEED 12
82#define NETWORK_CONTROL_GET_DUPLEX 13
83#define NETWORK_CONTROL_RESET_LINK 14
84#define NETWORK_CONTROL_GET_STATS 15
85#define NETWORK_CONTROL_ADD_MULTICAST 16
86#define NETWORK_CONTROL_DEL_MULTICAST 17
87#define NETWORK_CONTROL_GET_MULTICAST 18
90#define NETWORK_LINK_DOWN NETWORK_STATUS_DOWN
91#define NETWORK_LINK_UP NETWORK_STATUS_UP
94#define NETWORK_SPEED_NONE 0
95#define NETWORK_SPEED_10 10
96#define NETWORK_SPEED_100 100
97#define NETWORK_SPEED_1000 1000
100#define NETWORK_DUPLEX_NONE 0
101#define NETWORK_DUPLEX_HALF 1
102#define NETWORK_DUPLEX_FULL 2
105#define NETWORK_LOCK_NONE 0
106#define NETWORK_LOCK_READ 1
107#define NETWORK_LOCK_WRITE 2
110#define NETWORK_BUFFER_SIZE 1024
113#define NETWORK_EVENT_NONE 0x00000000
114#define NETWORK_EVENT_SYSTEM_START 0x00000001
115#define NETWORK_EVENT_SYSTEM_STOP 0x00000002
116#define NETWORK_EVENT_ADAPTERS_START 0x00000004
117#define NETWORK_EVENT_ADAPTERS_STOP 0x00000008
118#define NETWORK_EVENT_TRANSPORTS_START 0x00000010
119#define NETWORK_EVENT_TRANSPORTS_STOP 0x00000020
120#define NETWORK_EVENT_PROTOCOLS_START 0x00000040
121#define NETWORK_EVENT_PROTOCOLS_STOP 0x00000080
124#define NETWORK_EVENT_SIGNATURE 0xBE1D50C2
127#define NETWORK_EVENT_STATE_UNREGISTERED 0
128#define NETWORK_EVENT_STATE_REGISTERED 1
131#define NETWORK_EVENT_FLAG_NONE 0x00000000
134#define ADAPTER_TYPE_UNKNOWN 0
135#define ADAPTER_TYPE_WIRED 1
136#define ADAPTER_TYPE_LOOPBACK 2
137#define ADAPTER_TYPE_WIRELESS 3
138#define ADAPTER_TYPE_SLIP 4
139#define ADAPTER_TYPE_PPP 5
142#define ADAPTER_THREAD_NAME "Network Adapter"
143#define ADAPTER_THREAD_PRIORITY THREAD_PRIORITY_HIGHER
146#define ADAPTER_STATE_DISABLED 0
147#define ADAPTER_STATE_ENABLED 1
150#define ADAPTER_STATUS_DOWN 0
151#define ADAPTER_STATUS_UP 1
154#define CONFIG_TYPE_AUTO 0
155#define CONFIG_TYPE_STATIC 1
156#define CONFIG_TYPE_RARP 2
157#define CONFIG_TYPE_BOOTP 3
158#define CONFIG_TYPE_DHCP 4
159#define CONFIG_TYPE_PSEUDO 5
160#define CONFIG_TYPE_LOOPBACK 6
161#define CONFIG_TYPE_SLIP 7
162#define CONFIG_TYPE_PPP 8
164#define CONFIG_TYPE_UNKNOWN Word(-1)
167#define AUTH_TYPE_UNKNOWN 0
168#define AUTH_TYPE_EAP 1
169#define AUTH_TYPE_RSN 2
172#define FRAME_TYPE_UNKNOWN 0
173#define FRAME_TYPE_ETHERNET_II 1
174#define FRAME_TYPE_TOKEN_RING 3
175#define FRAME_TYPE_APPLETALK 5
176#define FRAME_TYPE_ETHERNET_8022 11
177#define FRAME_TYPE_ETHERNET_SNAP 98
178#define FRAME_TYPE_ETHERNET_8023 99
180#define FRAME_START_ETHERNET_SNAP 0xAAAA
181#define FRAME_START_ETHERNET_8023 0xFFFF
183#define ADAPTER_MODE_NONE 1
184#define ADAPTER_MODE_LOCAL 2
185#define ADAPTER_MODE_BROADCAST 3
186#define ADAPTER_MODE_LOCAL_MULTI 4
187#define ADAPTER_MODE_BROADCAST_MULTI 5
188#define ADAPTER_MODE_PROMISCUOUS 6
191#define CONFIG_ADAPTER_DISCOVER 0
192#define CONFIG_ADAPTER_REQUEST 1
193#define CONFIG_ADAPTER_RELEASE 2
194#define CONFIG_ADAPTER_RENEW 3
195#define CONFIG_ADAPTER_REBIND 4
196#define CONFIG_ADAPTER_INFORM 5
197#define CONFIG_ADAPTER_REBOOT 6
199#define CONFIG_RETRY_TIMEOUT 300000
200#define CONFIG_RENEW_TIMEOUT 60000
201#define CONFIG_REBIND_TIMEOUT 60000
204#define AUTH_COMMAND_ASSOCIATE 0
205#define AUTH_COMMAND_DISASSOCIATE 1
206#define AUTH_COMMAND_AUTHENTICATE 2
207#define AUTH_COMMAND_UNAUTHENTICATE 3
210#define MAX_MULTICAST_ADDRESS 8
212#define MAX_PHYSICAL_PACKET 2048
215#define HARDWARE_ADDRESS_SIZE 6
218#define MEDIA_TYPE_UNKNOWN 0x0000
220#define MEDIA_TYPE_ETHERNET 0x0001
221#define MEDIA_TYPE_TOKENRING 0x0006
222#define MEDIA_TYPE_IEEE80211 0x1000
223#define MEDIA_TYPE_LOOPBACK 0x1001
224#define MEDIA_TYPE_PPP 0x1002
225#define MEDIA_TYPE_SLIP 0x1003
228#define PACKET_MIN_TYPE 0x0600
230#define PACKET_TYPE_IP 0x0800
231#define PACKET_TYPE_IP6 0x86DD
232#define PACKET_TYPE_ARP 0x0806
233#define PACKET_TYPE_RARP 0x8035
234#define PACKET_TYPE_8021Q 0x8100
235#define PACKET_TYPE_IPX 0x8137
237#define PACKET_TYPE_EAPOL 0x888E
238#define PACKET_TYPE_RSN 0x88C7
239#define PACKET_TYPE_TDLS 0x890D
241#define PACKET_TYPE_RAW 0xFFFF
242#define PACKET_TYPE_LLC 0x0001
247#define MII_PHYSID1 0x02
248#define MII_PHYSID2 0x03
249#define MII_ADVERTISE 0x04
251#define MII_EXPANSION 0x06
252#define MII_CTRL1000 0x09
253#define MII_STAT1000 0x0a
254#define MII_MMD_CTRL 0x0d
255#define MII_MMD_DATA 0x0e
256#define MII_ESTATUS 0x0f
257#define MII_DCOUNTER 0x12
258#define MII_FCSCOUNTER 0x13
259#define MII_NWAYTEST 0x14
260#define MII_RERRCOUNTER 0x15
261#define MII_SREVISION 0x16
262#define MII_RESV1 0x17
263#define MII_LBRERROR 0x18
264#define MII_PHYADDR 0x19
265#define MII_RESV2 0x1a
266#define MII_TPISTATUS 0x1b
267#define MII_NCONFIG 0x1c
270#define BMCR_RESV 0x003f
271#define BMCR_SPEED1000 0x0040
272#define BMCR_CTST 0x0080
273#define BMCR_FULLDPLX 0x0100
274#define BMCR_ANRESTART 0x0200
275#define BMCR_ISOLATE 0x0400
276#define BMCR_PDOWN 0x0800
277#define BMCR_ANENABLE 0x1000
278#define BMCR_SPEED100 0x2000
279#define BMCR_LOOPBACK 0x4000
280#define BMCR_RESET 0x8000
283#define BMSR_ERCAP 0x0001
284#define BMSR_JCD 0x0002
285#define BMSR_LSTATUS 0x0004
286#define BMSR_ANEGCAPABLE 0x0008
287#define BMSR_RFAULT 0x0010
288#define BMSR_ANEGCOMPLETE 0x0020
289#define BMSR_RESV 0x00c0
290#define BMSR_ESTATEN 0x0100
291#define BMSR_100HALF2 0x0200
292#define BMSR_100FULL2 0x0400
293#define BMSR_10HALF 0x0800
294#define BMSR_10FULL 0x1000
295#define BMSR_100HALF 0x2000
296#define BMSR_100FULL 0x4000
297#define BMSR_100BASE4 0x8000
300#define ADVERTISE_SLCT 0x001f
301#define ADVERTISE_CSMA 0x0001
302#define ADVERTISE_10HALF 0x0020
303#define ADVERTISE_1000XFULL 0x0020
304#define ADVERTISE_10FULL 0x0040
305#define ADVERTISE_1000XHALF 0x0040
306#define ADVERTISE_100HALF 0x0080
307#define ADVERTISE_1000XPAUSE 0x0080
308#define ADVERTISE_100FULL 0x0100
309#define ADVERTISE_1000XPSE_ASYM 0x0100
310#define ADVERTISE_100BASE4 0x0200
311#define ADVERTISE_PAUSE_CAP 0x0400
312#define ADVERTISE_PAUSE_ASYM 0x0800
313#define ADVERTISE_RESV 0x1000
314#define ADVERTISE_RFAULT 0x2000
315#define ADVERTISE_LPACK 0x4000
316#define ADVERTISE_NPAGE 0x8000
318#define ADVERTISE_FULL ADVERTISE_100FULL | ADVERTISE_10FULL | ADVERTISE_CSMA
319#define ADVERTISE_ALL ADVERTISE_10HALF | ADVERTISE_10FULL | ADVERTISE_100HALF | ADVERTISE_100FULL
322#define LPA_SLCT 0x001f
323#define LPA_10HALF 0x0020
324#define LPA_1000XFULL 0x0020
325#define LPA_10FULL 0x0040
326#define LPA_1000XHALF 0x0040
327#define LPA_100HALF 0x0080
328#define LPA_1000XPAUSE 0x0080
329#define LPA_100FULL 0x0100
330#define LPA_1000XPAUSE_ASYM 0x0100
331#define LPA_100BASE4 0x0200
332#define LPA_PAUSE_CAP 0x0400
333#define LPA_PAUSE_ASYM 0x0800
334#define LPA_RESV 0x1000
335#define LPA_RFAULT 0x2000
336#define LPA_LPACK 0x4000
337#define LPA_NPAGE 0x8000
339#define LPA_DUPLEX LPA_10FULL | LPA_100FULL
340#define LPA_100 LPA_100FULL | LPA_100HALF | LPA_100BASE4
343#define EXPANSION_NWAY 0x0001
344#define EXPANSION_LCWP 0x0002
345#define EXPANSION_ENABLENPAGE 0x0004
346#define EXPANSION_NPCAPABLE 0x0008
347#define EXPANSION_MFAULTS 0x0010
348#define EXPANSION_RESV 0xffe0
350#define ESTATUS_1000_TFULL 0x2000
351#define ESTATUS_1000_THALF 0x1000
354#define NWAYTEST_RESV1 0x00ff
355#define NWAYTEST_LOOPBACK 0x0100
356#define NWAYTEST_RESV2 0xfe00
359#define ADVERTISE_1000FULL 0x0200
360#define ADVERTISE_1000HALF 0x0100
361#define CTL1000_AS_MASTER 0x0800
362#define CTL1000_ENABLE_MASTER 0x1000
365#define LPA_1000MSFAIL 0x8000
366#define LPA_1000LOCALRXOK 0x2000
367#define LPA_1000REMRXOK 0x1000
368#define LPA_1000FULL 0x0800
369#define LPA_1000HALF 0x0400
372#define FLOW_CTRL_TX 0x01
373#define FLOW_CTRL_RX 0x02
376#define MII_MMD_CTRL_DEVAD_MASK 0x1f
377#define MII_MMD_CTRL_ADDR 0x0000
378#define MII_MMD_CTRL_NOINCR 0x4000
379#define MII_MMD_CTRL_INCR_RDWT 0x8000
380#define MII_MMD_CTRL_INCR_ON_WT 0xC000
383#define PHY_LINK_DOWN 0
386#define PHY_LINK_UNKNOWN -1
389#define PHY_INTERFACE_MODE_NONE 0
390#define PHY_INTERFACE_MODE_INTERNAL 1
391#define PHY_INTERFACE_MODE_MII 2
392#define PHY_INTERFACE_MODE_GMII 3
393#define PHY_INTERFACE_MODE_SGMII 4
394#define PHY_INTERFACE_MODE_TBI 5
395#define PHY_INTERFACE_MODE_REVMII 6
396#define PHY_INTERFACE_MODE_RMII 7
397#define PHY_INTERFACE_MODE_RGMII 8
398#define PHY_INTERFACE_MODE_RGMII_ID 9
399#define PHY_INTERFACE_MODE_RGMII_RXID 10
400#define PHY_INTERFACE_MODE_RGMII_TXID 11
401#define PHY_INTERFACE_MODE_RTBI 12
402#define PHY_INTERFACE_MODE_SMII 13
403#define PHY_INTERFACE_MODE_XGMII 14
404#define PHY_INTERFACE_MODE_MOCA 15
405#define PHY_INTERFACE_MODE_QSGMII 16
406#define PHY_INTERFACE_MODE_TRGMII 17
407#define PHY_INTERFACE_MODE_1000BASEX 18
408#define PHY_INTERFACE_MODE_2500BASEX 19
409#define PHY_INTERFACE_MODE_RXAUI 20
410#define PHY_INTERFACE_MODE_XAUI 21
411#define PHY_INTERFACE_MODE_10GKR 22
412#define PHY_INTERFACE_MODE_USXGMII 23
415#define PHY_SPEED_10 10
416#define PHY_SPEED_100 100
417#define PHY_SPEED_1000 1000
419#define PHY_SPEED_UNKNOWN -1
422#define PHY_DUPLEX_HALF 0
423#define PHY_DUPLEX_FULL 1
425#define PHY_DUPLEX_UNKNOWN -1
428#define SERVICE_SET_UNKNOWN 0
429#define SERVICE_SET_BSS 1
430#define SERVICE_SET_ESS 2
431#define SERVICE_SET_IBSS 3
432#define SERVICE_SET_MBSS 4
435#define ETHERNET_ADDRESS_SIZE 6
436#define ETHERNET_HEADER_SIZE 14
437#define ETHERNET_VLAN_SIZE 4
438#define ETHERNET_CRC_SIZE 4
441#define ETHERNET_MTU 1500
442#define ETHERNET_MIN_PAYLOAD 46
443#define ETHERNET_MIN_PACKET_SIZE ETHERNET_HEADER_SIZE + ETHERNET_VLAN_SIZE + ETHERNET_MIN_PAYLOAD
444#define ETHERNET_MAX_PACKET_SIZE ETHERNET_HEADER_SIZE + ETHERNET_VLAN_SIZE + ETHERNET_MTU
446#define ETHERNET_TRANSMIT_BUFFER_SIZE ETHERNET_MAX_PACKET_SIZE
449#define LLC_HEADER_SIZE 3
452#define SNAP_HEADER_SIZE 5
625static const HARDWARE_ADDRESS HARDWARE_DEFAULT = {0x00,0x00,0x00,0x00,0x00,0x00};
626static const HARDWARE_ADDRESS HARDWARE_LOOPBACK = {0x00,0x00,0x00,0x00,0x00,0x01};
627static const HARDWARE_ADDRESS HARDWARE_BROADCAST = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
662static const HARDWARE_ADDRESS ETHERNET_DEFAULT = {0x00,0x00,0x00,0x00,0x00,0x00};
663static const HARDWARE_ADDRESS ETHERNET_LOOPBACK = {0x00,0x00,0x00,0x00,0x00,0x01};
664static const HARDWARE_ADDRESS ETHERNET_BROADCAST = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
665static const HARDWARE_ADDRESS ETHERNET_MULTICAST = {0x01,0x00,0x5E,0x00,0x00,0x00};
struct _DEVICE DEVICE
Definition devices.h:373
size_t HANDLE
Definition globaltypes.h:51
#define STDCALL
Definition globaltypes.h:45
#define PACKED
Definition globaltypes.h:48
_Bool BOOL
Built in Boolean type (1 byte) (Redeclared here for flexibility).
Definition globaltypes.h:55
HANDLE SEMAPHORE_HANDLE
Definition globaltypes.h:107
HANDLE BUFFER_HANDLE
Definition globaltypes.h:116
HANDLE MUTEX_HANDLE
Definition globaltypes.h:105
uint32_t STDCALL network_device_set_status(NETWORK_DEVICE *network, uint32_t status)
Set the status of the specified network and send a notification.
uint32_t STDCALL(* network_device_read_proc)(NETWORK_DEVICE *network, void *buffer, uint32_t size, uint32_t *length)
Definition network.h:553
uint32_t STDCALL network_device_notification(NETWORK_DEVICE *network, network_notification_cb callback, void *data, uint32_t notification, uint32_t flags)
uint32_t STDCALL auth_command_to_string(uint16_t command, char *string, uint32_t len)
struct _LLC_HEADER LLC_HEADER
Definition network.h:643
uint32_t STDCALL network_device_destroy(NETWORK_DEVICE *network)
Destroy an existing Network entry.
uint32_t STDCALL network_buffer_transmit(NETWORK_DEVICE *network, NETWORK_ENTRY *entry)
Transmit a completed transmit buffer to the specified network device. The entry must have been alloca...
HANDLE STDCALL network_event_register(network_event_callback_cb callback, void *data, uint32_t event)
Register a callback for one or more network events.
struct _NETWORK_BUFFER NETWORK_BUFFER
Definition network.h:493
NETWORK_DEVICE *STDCALL network_device_create_ex(uint32_t size)
Create a new Network entry.
uint32_t STDCALL network_device_close(NETWORK_DEVICE *network)
uint32_t STDCALL network_event_release(NETWORK_EVENT *event)
Deregister and Destroy an Event from the Event table.
uint32_t STDCALL network_device_open(NETWORK_DEVICE *network)
struct _ETHERNET_HEADER ETHERNET_HEADER
Definition network.h:633
NETWORK_EVENT *STDCALL network_event_check(NETWORK_EVENT *event)
Check if the supplied Event is in the event table.
#define HARDWARE_ADDRESS_SIZE
SizeOf(THardwareAddress).
Definition network.h:215
struct _PACKET_FRAGMENT PACKET_FRAGMENT
Definition network.h:461
uint32_t STDCALL network_device_type_to_string(uint32_t networktype, char *string, uint32_t len)
uint32_t STDCALL(* network_buffer_release_proc)(NETWORK_DEVICE *network, NETWORK_ENTRY *entry)
Definition network.h:558
uint32_t STDCALL network_get_count(void)
Get the current network count.
HARDWARE_ADDRESS MULTICAST_ADDRESSES[MAX_MULTICAST_ADDRESS]
Definition network.h:459
uint32_t STDCALL network_buffer_release(NETWORK_DEVICE *network, NETWORK_ENTRY *entry)
Release a receive buffer to the specified network device, the entry must have been returned from Netw...
uint32_t STDCALL(* network_buffer_transmit_proc)(NETWORK_DEVICE *network, NETWORK_ENTRY *entry)
Definition network.h:560
uint32_t STDCALL network_device_state_to_string(uint32_t networkstate, char *string, uint32_t len)
struct _NETWORK_ENTRY NETWORK_ENTRY
Definition network.h:503
uint16_t STDCALL match_string_to_phy_interface_mode(char *mode)
NETWORK_DEVICE *STDCALL network_device_find(uint32_t networkid)
struct _SNAP_HEADER SNAP_HEADER
Definition network.h:653
uint32_t STDCALL frame_type_to_string(uint16_t _type, char *string, uint32_t len)
BOOL STDCALL compare_hardware_address(HARDWARE_ADDRESS *address1, HARDWARE_ADDRESS *address2)
uint32_t STDCALL phy_duplex_mode_to_string(uint16_t mode, char *string, uint32_t len)
struct _ADAPTER_STATISTICS ADAPTER_STATISTICS
Definition network.h:470
uint32_t STDCALL auth_type_to_string(uint16_t _type, char *string, uint32_t len)
HARDWARE_ADDRESS HARDWARE_ADDRESSES[]
Definition network.h:457
#define NETWORK_BUFFER_SIZE
Definition network.h:110
uint32_t STDCALL adapter_mode_to_string(uint16_t mode, char *string, uint32_t len)
uint32_t STDCALL(* network_notification_cb)(DEVICE *device, void *data, uint32_t notification)
Definition network.h:548
uint32_t STDCALL(* network_buffer_allocate_proc)(NETWORK_DEVICE *network, NETWORK_ENTRY *entry)
Definition network.h:557
uint32_t STDCALL network_device_enumerate(network_enumerate_cb callback, void *data)
uint32_t STDCALL adapter_config_to_string(uint16_t config, char *string, uint32_t len)
uint32_t STDCALL network_device_write(NETWORK_DEVICE *network, void *buffer, uint32_t size, uint32_t *length)
uint32_t STDCALL network_event_notify(uint32_t event)
uint32_t STDCALL(* network_device_write_proc)(NETWORK_DEVICE *network, void *buffer, uint32_t size, uint32_t *length)
Definition network.h:554
#define ETHERNET_ADDRESS_SIZE
SizeOf(TEthernetAddress).
Definition network.h:435
BOOL STDCALL compare_hardware_multicast(HARDWARE_ADDRESS *address)
uint32_t STDCALL adapter_state_to_string(int state, char *string, uint32_t len)
struct _NETWORK_EVENT NETWORK_EVENT
Definition network.h:604
struct _NETWORK_QUEUE NETWORK_QUEUE
Definition network.h:515
uint32_t STDCALL config_type_to_string(uint16_t _type, char *string, uint32_t len)
uint32_t STDCALL network_device_read(NETWORK_DEVICE *network, void *buffer, uint32_t size, uint32_t *length)
uint32_t STDCALL phy_link_speed_to_string(uint16_t speed, char *string, uint32_t len)
uint32_t STDCALL network_media_type_to_string(uint16_t _type, char *string, uint32_t len)
NETWORK_EVENT *STDCALL network_event_allocate(network_event_callback_cb callback, void *data, uint32_t event)
Create and Register a new Event entry in the Event table.
void STDCALL random_hardware_address(HARDWARE_ADDRESS *address)
BOOL STDCALL compare_hardware_default(HARDWARE_ADDRESS *address)
uint32_t STDCALL network_device_deregister(NETWORK_DEVICE *network)
Deregister a Network from the Network table.
NETWORK_DEVICE *STDCALL network_device_create(void)
Create a new Network entry.
uint32_t STDCALL(* network_device_control_proc)(NETWORK_DEVICE *network, int request, size_t argument1, size_t *argument2)
Definition network.h:555
uint32_t STDCALL(* network_device_open_proc)(NETWORK_DEVICE *network)
Definition network.h:551
int32_t STDCALL network_get_last_error(void)
Get the last network error value for the current Thread.
uint32_t STDCALL(* network_buffer_receive_proc)(NETWORK_DEVICE *network, NETWORK_ENTRY *entry)
Definition network.h:559
BOOL STDCALL valid_hardware_address(HARDWARE_ADDRESS *address)
struct _NETWORK_PACKET NETWORK_PACKET
Definition network.h:483
NETWORK_DEVICE *STDCALL network_device_check(NETWORK_DEVICE *network)
Check if the supplied Network is in the network table.
uint32_t STDCALL hardware_address_to_string(HARDWARE_ADDRESS *address, char *separator, char *string, uint32_t len)
uint32_t STDCALL network_stop(void)
uint32_t STDCALL(* network_device_close_proc)(NETWORK_DEVICE *network)
Definition network.h:552
uint32_t STDCALL(* network_enumerate_cb)(NETWORK_DEVICE *network, void *data)
Definition network.h:546
#define MAX_MULTICAST_ADDRESS
Maximum number of addresses per adapter.
Definition network.h:210
uint8_t HARDWARE_ADDRESS[HARDWARE_ADDRESS_SIZE]
Definition network.h:455
BOOL STDCALL network_start_completed(void)
Returns True if the network sub system has been started.
uint32_t STDCALL phy_interface_mode_to_string(uint16_t mode, char *string, uint32_t len)
uint32_t STDCALL network_device_state_to_notification(uint32_t state)
Convert a Network state value into the notification code for device notifications.
void STDCALL network_set_last_error(int32_t error)
Set the last network error value for the current Thread.
uint32_t STDCALL network_event_deregister(HANDLE handle)
Deregister a network event callback.
uint32_t STDCALL network_device_set_state(NETWORK_DEVICE *network, uint32_t state)
Set the state of the specified network and send a notification.
uint32_t STDCALL adapter_type_to_string(uint16_t _type, char *string, uint32_t len)
NETWORK_DEVICE *STDCALL network_device_find_by_name(const char *name)
uint32_t STDCALL network_buffer_allocate(NETWORK_DEVICE *network, NETWORK_ENTRY *entry)
Allocate a transmit buffer from the specified network device, the returned entry will include a buffe...
void STDCALL string_to_hardware_address(char *string, HARDWARE_ADDRESS *address)
uint32_t STDCALL network_device_register(NETWORK_DEVICE *network)
Register a new Network in the Network table.
uint32_t STDCALL network_device_status_to_notification(uint32_t status)
Convert a Network status value into the notification code for device notifications.
uint32_t STDCALL network_device_control(NETWORK_DEVICE *network, int request, size_t argument1, size_t *argument2)
BOOL STDCALL compare_hardware_broadcast(HARDWARE_ADDRESS *address)
struct _NETWORK_DEVICE NETWORK_DEVICE
Definition network.h:543
uint32_t STDCALL(* network_event_callback_cb)(void *data, uint32_t event)
Definition network.h:607
uint32_t STDCALL network_buffer_receive(NETWORK_DEVICE *network, NETWORK_ENTRY *entry)
Receive a completed receive buffer from the specified network device. The returned entry will contain...
uint32_t STDCALL adapter_status_to_string(int status, char *string, uint32_t len)
uint8_t ETHERNET_ADDRESS[ETHERNET_ADDRESS_SIZE]
Definition network.h:630
struct _NETWORK_STATISTICS NETWORK_STATISTICS
Definition network.h:527
uint32_t STDCALL packet_type_to_string(uint16_t _type, char *string, uint32_t len)
uint32_t STDCALL network_device_status_to_string(uint32_t networkstatus, char *string, uint32_t len)
uint32_t STDCALL network_start(void)
NETWORK_DEVICE *STDCALL network_device_find_by_description(const char *description)
uint32_t STDCALL config_command_to_string(uint16_t command, char *string, uint32_t len)
uint64_t bytesout
Definition network.h:476
uint64_t errorsin
Definition network.h:477
uint64_t bytesin
Definition network.h:475
uint64_t packetsin
Definition network.h:473
uint64_t errorsout
Definition network.h:478
uint64_t packetslost
Definition network.h:479
uint64_t packetsout
Definition network.h:474
NETWORK_PACKET * packets[NETWORK_BUFFER_SIZE]
Definition network.h:499
uint32_t start
Index of first packet ready.
Definition network.h:497
uint32_t count
Number of packets ready in buffer.
Definition network.h:498
SEMAPHORE_HANDLE wait
Packet ready semaphore.
Definition network.h:496
uint64_t bufferunavailable
Definition network.h:597
MUTEX_HANDLE lock
Network lock.
Definition network.h:580
uint64_t transmitbytes
Definition network.h:591
NETWORK_QUEUE transmitqueue
Queue for transmit packets (If applicable).
Definition network.h:586
NETWORK_QUEUE receivequeue
Queue for receive packets.
Definition network.h:585
network_buffer_allocate_proc bufferallocate
A Device specific BufferAllocate method implementing a standard Network device interface.
Definition network.h:575
network_device_open_proc deviceopen
A Device specific DeviceOpen method implementing a standard Network device interface.
Definition network.h:570
network_device_close_proc deviceclose
A Device specific DeviceClose method implementing a standard Network device interface.
Definition network.h:571
uint64_t bufferoverruns
Definition network.h:596
DEVICE device
The Device entry for this Network.
Definition network.h:565
uint64_t statuserrors
Definition network.h:595
network_buffer_receive_proc bufferreceive
A Device specific BufferReceive method implementing a standard Network device interface.
Definition network.h:577
uint32_t networkstate
Network state (eg NETWORK_STATE_OPEN).
Definition network.h:568
network_buffer_transmit_proc buffertransmit
A Device specific BufferTransmit method implementing a standard Network device interface.
Definition network.h:578
uint64_t receivecount
Definition network.h:589
NETWORK_DEVICE * prev
Previous entry in Network table.
Definition network.h:599
NETWORK_BUFFER buffer
Network receive buffer.
Definition network.h:581
uint32_t networkstatus
Network status (eg NETWORK_STATUS_UP).
Definition network.h:569
uint64_t statuscount
Definition network.h:594
BUFFER_HANDLE transmitbuffer
Buffer for transmit packets.
Definition network.h:584
NETWORK_DEVICE * next
Next entry in Network table.
Definition network.h:600
uint32_t networkid
Unique Id of this Network in the Network table.
Definition network.h:567
uint64_t receiveerrors
Definition network.h:590
uint64_t receivebytes
Definition network.h:588
BUFFER_HANDLE receivebuffer
Buffer for receive packets.
Definition network.h:583
uint64_t transmitcount
Definition network.h:592
uint64_t transmiterrors
Definition network.h:593
network_buffer_release_proc bufferrelease
A Device specific BufferRelease method implementing a standard Network device interface.
Definition network.h:576
network_device_control_proc devicecontrol
A Device specific DeviceControl method implementing a standard Network device interface.
Definition network.h:574
network_device_read_proc deviceread
A Device specific DeviceRead method implementing a standard Network device interface.
Definition network.h:572
SEMAPHORE_HANDLE transmitwait
Transmit complete semaphore.
Definition network.h:582
network_device_write_proc devicewrite
A Device specific DeviceWrite method implementing a standard Network device interface.
Definition network.h:573
NETWORK_PACKET * packets[]
Array of 0 to Count - 1 packets in this entry (Allocated by driver that owns this entry,...
Definition network.h:511
void * buffer
Pointer to buffer (Allocated by driver that owns this entry).
Definition network.h:506
uint32_t count
Number of packets in the entry (Set by driver that owns this entry, must be at least one).
Definition network.h:509
uint32_t offset
Offset to start of data (Data for first packet will be at Buffer plus Offset, must be less than size)...
Definition network.h:508
void * driverdata
Driver private data (Managed by driver that owns this entry).
Definition network.h:510
uint32_t size
Size of the buffer (Total size, usable size is Size minus Offset).
Definition network.h:507
network_event_callback_cb callback
The callback for network events.
Definition network.h:615
uint32_t eventflags
Event flags (eg NETWORK_EVENT_FLAG_NONE).
Definition network.h:614
uint32_t eventstate
Event state (eg Registered/Unregistered).
Definition network.h:613
void * data
A pointer to callback specific data to be passed with events (Optional).
Definition network.h:616
uint32_t signature
Signature for entry validation.
Definition network.h:612
NETWORK_EVENT * next
Next entry in Event table.
Definition network.h:620
uint32_t event
The mask of events to notify on (eg NETWORK_EVENT_SYSTEM_START etc).
Definition network.h:617
NETWORK_EVENT * prev
Previous entry in Event table.
Definition network.h:619
void * buffer
Pointer to buffer (Set by driver that owns this packet).
Definition network.h:486
int32_t length
Length of packet data (Set by driver on Receive / Set by caller on Transmit, contains maximum length ...
Definition network.h:488
void * data
Start of data within buffer (Set by driver that owns this packet).
Definition network.h:487
uint32_t flags
Packet specific flags (eg Error, Broadcast etc) (Dependent on network type).
Definition network.h:489
uint32_t start
Index of first entry ready.
Definition network.h:520
BUFFER_HANDLE buffer
Handle for entry buffers.
Definition network.h:518
uint32_t flags
Queue specific flags (eg Paused, Halted etc) (Managed by driver).
Definition network.h:522
NETWORK_ENTRY * entries[]
Array of 0 to Total - 1 entries in this queue (Allocated by driver that owns this queue).
Definition network.h:523
uint32_t count
Number of entries ready in queue.
Definition network.h:521
SEMAPHORE_HANDLE wait
Entry ready semaphore.
Definition network.h:519
uint64_t bufferunavailable
Definition network.h:539
uint64_t transmitbytes
Definition network.h:533
uint64_t bufferoverruns
Definition network.h:538
uint64_t statuserrors
Definition network.h:537
uint64_t receivecount
Definition network.h:531
uint64_t statuscount
Definition network.h:536
uint64_t receiveerrors
Definition network.h:532
uint64_t receivebytes
Definition network.h:530
uint64_t transmitcount
Definition network.h:534
uint64_t transmiterrors
Definition network.h:535
int size
Definition network.h:464
void * data
Definition network.h:465
PACKET_FRAGMENT * next
Definition network.h:466