12static unsigned char IsInitialized=0, IsNetStackInitialized=0;
13static char NIFLinkState = 0;
20void NetManToggleGlobalNetIFLinkState(
unsigned char state)
24 NetManUpdateStackNIFLinkState();
27int NetManGetGlobalNetIFLinkState(
void)
32void NetManUpdateStackNIFLinkState(
void)
34 if(IsNetStackInitialized)
37 MainNetProtStack.LinkStateUp();
39 MainNetProtStack.LinkStateDown();
49 if((result=NetManInitRPCServer())==0)
51 if((result=NetManInitRPCClient())==0) IsInitialized = 1;
58void NetManDeinit(
void)
62 NetManUnregisterNetworkStack();
64 NetManDeinitRPCClient();
65 NetManDeinitRPCServer();
74 if((result=NetManInit())==0)
76 if(!IsNetStackInitialized)
78 if((result=NetManRPCRegisterNetworkStack())==0)
80 memcpy(&MainNetProtStack, stack,
sizeof(MainNetProtStack));
81 IsNetStackInitialized=1;
82 if((result=NetManRPCAllocRxBuffers()) == 0)
83 NetManUpdateStackNIFLinkState();
92void NetManUnregisterNetworkStack(
void)
94 if(IsNetStackInitialized)
96 NetManRPCUnregisterNetworkStack();
97 memset(&MainNetProtStack, 0,
sizeof(MainNetProtStack));
99 IsNetStackInitialized=0;
103void NetManNetIFXmit(
void)
106 NetManRpcNetIFXmit();
109int NetManIoctl(
unsigned int command,
void *arg,
unsigned int arg_len,
void *output,
unsigned int length)
111 return IsInitialized?NetManRpcIoctl(command, arg, arg_len, output, length):-1;
114void *NetManNetProtStackAllocRxPacket(
unsigned int length,
void **payload)
116 return IsNetStackInitialized?MainNetProtStack.AllocRxPacket(length, payload):NULL;
119void NetManNetProtStackFreeRxPacket(
void *packet)
121 if(IsNetStackInitialized) MainNetProtStack.FreeRxPacket(packet);
124void NetManNetProtStackEnQRxPacket(
void *packet)
126 if(IsNetStackInitialized)
127 MainNetProtStack.EnQRxPacket(packet);
130int NetManTxPacketNext(
void **payload)
132 return IsInitialized?MainNetProtStack.NextTxPacket(payload):-1;
135void NetManTxPacketDeQ(
void)
138 MainNetProtStack.DeQTxPacket();
141int NetManTxPacketAfter(
void **payload)
143 return IsInitialized?MainNetProtStack.AfterTxPacket(payload):-1;
146void NetManNetProtStackReallocRxPacket(
void *packet,
unsigned int length)
148 if(IsNetStackInitialized) MainNetProtStack.ReallocRxPacket(packet, length);