应用程序
|
物理媒体
|
Socket层
BSD socket
协议层
TCP/IP UDP
接口层(MUX)
数据链路层
Enthernet ppp slip
|
互联网协议
|
数据流
|
通用协议
|
MUX
|
以太网
|
共享网络
|
串行链路
|
其他
|
typedef struct dev_obj
{
char name[END_NAME_MAX];
int unit;
char description[END_DESC_MAX];
void* pDevice;
} DEV_OBJ;
|
typedef struct end_object
{
NODE node;
DEV_OBJ devObject;
STATUS(*receiveRtn)(void*, M_BLK_ID);
BOOL(*outputFilter)(void*,long,M_BLK_ID, LL_HDR_INFO *, void*);
void* pOutputFilterSpare;
BOOL
attached;
SEM_ID
txSem; long flags; struct net_funcs * pFuncTable;
M2_INTERFACETBL
mib2Tbl;
LIST
multiList;
int
nMulti;
LIST
protocols;
BOOL snarfProto;
NET_POOL_ID pNetPool;
} END_OBJ;
|
typedef struct llHdrInfo
{
int destAddrOffset;
int destSize;
int srcAddrOffset;
int srcSize;
int ctrlAddrOffset;
int ctrlSize;
int pktType;
int dataOffset;
} LL_HDR_INFO;
|
typedef struct
{
int
ifIndex;
char
ifDescr [M2DISPLAYSTRSIZE];
long
ifType;
long
ifMtu;
unsigned long ifSpeed;
M2_PHYADDR ifPhysAddress;
long
ifAdminStatus;
long
ifOperStatus;
unsigned long
ifLastChange;
unsigned long
ifInOctets;
unsigned long
ifInUcastPkts;
unsigned long
ifInNUcastPkts;
unsigned long
ifInDiscards;
unsigned long
ifInErrors;
unsigned long ifInUnknownProtos;
unsigned long
ifOutOctets;
unsigned long
ifOutUcastPkts;
unsigned long
ifOutNUcastPkts;
unsigned long
ifOutDiscards;
unsigned long
ifOutErrors;
unsigned long
ifOutQLen;
M2_OBJECTID ifSpecific; } M2_INTERFACETBL;
|
typedef struct net_funcs
{
STATUS
(*start) (END_OBJ*);
STATUS
(*stop) (END_OBJ*);
STATUS
(*unload) (END_OBJ*);
int
(*ioctl) (END_OBJ*, int, caddr_t);
STATUS (*send) (END_OBJ* , M_BLK_ID);
STATUS (*mCastAddrAdd) (END_OBJ*, char*);
STATUS (*mCastAddrDel) (END_OBJ*, char*);
STATUS(*mCastAddrGet)(END_OBJ*,MULTI_TABLE*);
STATUS (*pollSend) (END_OBJ*, M_BLK_ID);
STATUS (*pollRcv) (END_OBJ*, M_BLK_ID);
M_BLK_ID(*formAddress)(M_BLK_ID,M_BLK_ID, M_BLK_ID);
STATUS (*packetDataGet) (M_BLK_ID, LL_HDR_INFO *);
STATUS(*addrGet);
(M_BLK_ID,M_BLK_ID,M_BLK_ID,M_BLK_ID,
M_BLK_ID);
} NET_FUNCS;
|
一个网络协议提供一个例程给驱动程序分配一个网络服务地址。这个例程通过调用muxBind()例程把协议和驱动程序绑定起来。完成这一步后,网络协议就可以跟通讯设备进行数据收发