Wirefilter: new markov mode (see man page)
[vde.git] / ipn / test / test0x.c
blob4510908c087aee7524f697cc91d1a3a5bd370ba2
1 #include <stdio.h>
2 #include <errno.h>
3 #include <sys/types.h>
4 #include <sys/socket.h>
5 #include <sys/un.h>
7 #define AF_IPN AF_NETBEUI
8 #define PF_IPN AF_IPN
9 #define IPN_ANY 0
10 #define IPN_BROADCAST 1
11 #define IPN_HUB 1
12 #define IPN_VDESWITCH 2
13 #define IPN_VDESWITCH_L3 3
15 #define IPN_SO_PREBIND 0x80
16 #define IPN_SO_PORT 0
17 #define IPN_SO_DESCR 1
18 #define IPN_SO_MTU (IPN_SO_PREBIND | 0)
19 #define IPN_SO_NUMNODES (IPN_SO_PREBIND | 1)
20 #define IPN_SO_MSGPOOLSIZE (IPN_SO_PREBIND | 2)
21 #define IPN_SO_FLAGS (IPN_SO_PREBIND | 3)
23 #define IPN_PORTNO_ANY -1
25 #define IPN_DESCRLEN 32
27 #define IPN_FLAG_LOSSLESS 1
29 #define LIMIT 10000
30 char buf[256];
31 struct sockaddr_un sun={.sun_family=AF_IPN,.sun_path="/tmp/sockipn"};
32 main()
34 int s=socket(AF_IPN,SOCK_RAW,IPN_BROADCAST);
35 int err;
36 int len;
37 int i;
38 if (s< 0)
39 perror("socket");
40 printf("s=%d\n",s);
41 err=bind(s,(struct sockaddr *)&sun,sizeof(sun));
42 if (err<0)
43 perror("bind");
44 err=connect(s,NULL,0);
45 if (err<0)
46 perror("connect");
47 for (i=0;i<LIMIT;i++) {
48 sprintf(buf,"%d\n",i);
49 err=write(s,buf,256);
50 if (err<0)
51 perror("write sock");
53 if (len < 0)
54 perror("read stdin");
55 close(s);