123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480 |
- /*++
- Copyright (c) 2013 Minoca Corp. All Rights Reserved
- Module Name:
- netcore.h
- Abstract:
- This header contains internal definitions for the core networking library.
- Author:
- Evan Green 4-Apr-2013
- --*/
- //
- // ------------------------------------------------------------------- Includes
- //
- //
- // Redefine the API define into an export.
- //
- #define NET_API __DLLEXPORT
- #include <minoca/net/netdrv.h>
- //
- // ---------------------------------------------------------------- Definitions
- //
- //
- // Define the allocation tag used across the networking core library.
- //
- #define NET_CORE_ALLOCATION_TAG 0x4374654E // 'CteN'
- //
- // Define the maximum number of incoming but not accepted connections that are
- // allowed to accumulate in a socket.
- //
- #define NET_MAX_INCOMING_CONNECTIONS 512
- #define NET_PRINT_ADDRESS_STRING_LENGTH 200
- //
- // ------------------------------------------------------ Data Type Definitions
- //
- //
- // -------------------------------------------------------------------- Globals
- //
- //
- // Define the global debug flag, which propagates throughout the networking
- // subsystem.
- //
- extern BOOL NetGlobalDebug;
- //
- // Define the list of supported socket types.
- //
- extern LIST_ENTRY NetProtocolList;
- extern LIST_ENTRY NetNetworkList;
- extern LIST_ENTRY NetDataLinkList;
- extern PSHARED_EXCLUSIVE_LOCK NetPluginListLock;
- //
- // Define the list of raw sockets. These do not get put in the socket trees.
- //
- extern LIST_ENTRY NetRawSocketsList;
- extern PSHARED_EXCLUSIVE_LOCK NetRawSocketsLock;
- //
- // -------------------------------------------------------- Function Prototypes
- //
- KSTATUS
- NetpInitializeNetworkLayer (
- VOID
- );
- /*++
- Routine Description:
- This routine initialize support for generic Network layer functionality.
- Arguments:
- None.
- Return Value:
- Status code.
- --*/
- KSTATUS
- NetpInitializeBuffers (
- VOID
- );
- /*++
- Routine Description:
- This routine initializes support for network buffers.
- Arguments:
- None.
- Return Value:
- Status code.
- --*/
- VOID
- NetpDestroyBuffers (
- VOID
- );
- /*++
- Routine Description:
- This routine destroys any allocations made during network buffer
- initialization.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- COMPARISON_RESULT
- NetpCompareNetworkAddresses (
- PNETWORK_ADDRESS FirstAddress,
- PNETWORK_ADDRESS SecondAddress
- );
- /*++
- Routine Description:
- This routine compares two network addresses.
- Arguments:
- FirstAddress - Supplies a pointer to the left side of the comparison.
- SecondAddress - Supplies a pointer to the second side of the comparison.
- Return Value:
- Same if the two nodes have the same value.
- Ascending if the first node is less than the second node.
- Descending if the second node is less than the first node.
- --*/
- COMPARISON_RESULT
- NetpCompareFullyBoundSockets (
- PRED_BLACK_TREE Tree,
- PRED_BLACK_TREE_NODE FirstNode,
- PRED_BLACK_TREE_NODE SecondNode
- );
- /*++
- Routine Description:
- This routine compares two fully bound sockets, where both the local and
- remote addresses are fixed.
- Arguments:
- Tree - Supplies a pointer to the Red-Black tree that owns both nodes.
- FirstNode - Supplies a pointer to the left side of the comparison.
- SecondNode - Supplies a pointer to the second side of the comparison.
- Return Value:
- Same if the two nodes have the same value.
- Ascending if the first node is less than the second node.
- Descending if the second node is less than the first node.
- --*/
- COMPARISON_RESULT
- NetpCompareLocallyBoundSockets (
- PRED_BLACK_TREE Tree,
- PRED_BLACK_TREE_NODE FirstNode,
- PRED_BLACK_TREE_NODE SecondNode
- );
- /*++
- Routine Description:
- This routine compares two locally bound sockets, where the local address
- and port are fixed.
- Arguments:
- Tree - Supplies a pointer to the Red-Black tree that owns both nodes.
- FirstNode - Supplies a pointer to the left side of the comparison.
- SecondNode - Supplies a pointer to the second side of the comparison.
- Return Value:
- Same if the two nodes have the same value.
- Ascending if the first node is less than the second node.
- Descending if the second node is less than the first node.
- --*/
- COMPARISON_RESULT
- NetpCompareUnboundSockets (
- PRED_BLACK_TREE Tree,
- PRED_BLACK_TREE_NODE FirstNode,
- PRED_BLACK_TREE_NODE SecondNode
- );
- /*++
- Routine Description:
- This routine compares two unbound sockets, meaning only the local port
- number is known.
- Arguments:
- Tree - Supplies a pointer to the Red-Black tree that owns both nodes.
- FirstNode - Supplies a pointer to the left side of the comparison.
- SecondNode - Supplies a pointer to the second side of the comparison.
- Return Value:
- Same if the two nodes have the same value.
- Ascending if the first node is less than the second node.
- Descending if the second node is less than the first node.
- --*/
- //
- // Prototypes to the entry points for built in protocols.
- //
- VOID
- NetpUdpInitialize (
- VOID
- );
- /*++
- Routine Description:
- This routine initializes support for UDP sockets.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- VOID
- NetpTcpInitialize (
- VOID
- );
- /*++
- Routine Description:
- This routine initializes support for TCP sockets.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- VOID
- NetpRawInitialize (
- VOID
- );
- /*++
- Routine Description:
- This routine initializes support for raw sockets.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- VOID
- NetpNetlinkGenericInitialize (
- ULONG Phase
- );
- /*++
- Routine Description:
- This routine initializes support for UDP sockets.
- Arguments:
- Phase - Supplies the phase of the initialization. Phase 0 happens before
- the networking core registers with the kernel, meaning sockets cannot
- be created. Phase 1 happens after the networking core has registered
- with the kernel allowing socket creation.
- Return Value:
- None.
- --*/
- //
- // Prototypes to entry points for built in networks.
- //
- VOID
- NetpIp4Initialize (
- VOID
- );
- /*++
- Routine Description:
- This routine initializes support for IPv4 packets.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- VOID
- NetpArpInitialize (
- VOID
- );
- /*++
- Routine Description:
- This routine initializes support for ARP packets.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- VOID
- NetpNetlinkInitialize (
- VOID
- );
- /*++
- Routine Description:
- This routine initializes support for netlink packets.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- //
- // Prototypes to entry points for built in data link layers.
- //
- VOID
- NetpEthernetInitialize (
- VOID
- );
- /*++
- Routine Description:
- This routine initializes support for Ethernet frames.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- //
- // Prototypes to entry points for built in components.
- //
- VOID
- NetpDhcpInitialize (
- VOID
- );
- /*++
- Routine Description:
- This routine initializes support for DHCP.
- Arguments:
- None.
- Return Value:
- None.
- --*/
|