XINU
ethloop.h
Go to the documentation of this file.
1 
6 /* Embedded Xinu, Copyright (C) 2009. All rights reserved. */
7 
8 #ifndef _ETHLOOP_H_
9 #define _ETHLOOP_H_
10 
11 
12 #define ELOOP_MTU 1500
13 #define ELOOP_LINKHDRSIZE ETH_HDR_LEN
14 
15 #define ELOOP_BUFSIZE ELOOP_MTU + ELOOP_LINKHDRSIZE
16 #define ELOOP_NBUF 100
17 
18 #define ELOOP_CTRL_GETHOLD 1
19 #define ELOOP_CTRL_SETFLAG 2
20 #define ELOOP_CTRL_CLRFLAG 3
21 
22 #define ELOOP_FLAG_HOLDNXT 0x01
23 #define ELOOP_FLAG_DROPNXT 0x04
24 #define ELOOP_FLAG_DROPALL 0x08
26 #define ELOOP_STATE_FREE 0
27 #define ELOOP_STATE_ALLOC 1
28 
32 struct ethloop
33 {
34  int state;
35  struct dentry *dev;
36  int poolid;
39  /* Packet queue */
40  int index;
42  int count;
43  char *buffer[ELOOP_NBUF];
46  /* Hold packet */
48  char *hold;
49  int holdlen;
51  /* Statistics */
53 };
54 
55 extern struct ethloop elooptab[];
56 
57 /* Driver functions */
58 devcall ethloopInit(struct dentry *);
59 devcall ethloopOpen(struct dentry *);
60 devcall ethloopClose(struct dentry *);
61 devcall ethloopRead(struct dentry *, void *, uint32);
62 devcall ethloopWrite(struct dentry *, void *, uint32);
63 devcall ethloopControl(struct dentry *, int, int32, int32);
64 
65 #endif /* _ETHLOOP_H_ */
unsigned char byte
符号なし8ビット値(unsigned char)
Definition: kernel.h:7
devcall ethloopControl(struct dentry *, int, int32, int32)
int state
Definition: ethloop.h:34
devcall ethloopWrite(struct dentry *, void *, uint32)
uint32 nout
Definition: ethloop.h:52
devcall ethloopInit(struct dentry *)
devcall ethloopClose(struct dentry *)
int pktlen[ELOOP_NBUF]
Definition: ethloop.h:44
#define ELOOP_NBUF
Definition: ethloop.h:16
sid32 sem
Definition: ethloop.h:41
devcall ethloopRead(struct dentry *, void *, uint32)
sid32 hsem
Definition: ethloop.h:47
char * hold
Definition: ethloop.h:48
Definition: conf.h:6
char * buffer[ELOOP_NBUF]
Definition: ethloop.h:43
devcall ethloopOpen(struct dentry *)
int poolid
Definition: ethloop.h:36
int int32
符号あり32ビット整数(int)
Definition: kernel.h:11
int count
Definition: ethloop.h:42
struct dentry * dev
Definition: ethloop.h:35
int holdlen
Definition: ethloop.h:49
struct ethloop elooptab[]
unsigned int uint32
符号なし32ビット整数(unsigned int)
Definition: kernel.h:15
int32 devcall
デバイスコール関数 返り値の型
Definition: kernel.h:49
byte flags
Definition: ethloop.h:37
int32 sid32
セマフォID
Definition: kernel.h:22
int index
Definition: ethloop.h:40