4 #include <sys/socket.h>
7 #define AF_IPN AF_NETBEUI
10 #define IPN_BROADCAST 1
12 #define IPN_VDESWITCH 2
13 #define IPN_VDESWITCH_L3 3
15 #define IPN_SO_PREBIND 0x80
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)
22 #define IPN_SO_MODE (IPN_SO_PREBIND | 4)
24 #define IPN_PORTNO_ANY -1
26 #define IPN_DESCRLEN 32
28 #define IPN_FLAG_LOSSLESS 1
31 struct sockaddr_un sun
={.sun_family
=AF_IPN
,.sun_path
="/tmp/sockipn"};
34 //int s=socket(AF_IPN,SOCK_RAW,IPN_BROADCAST);
35 int s
=socket(AF_IPN
,SOCK_RAW
,IPN_VDESWITCH
);
38 int flags
=IPN_FLAG_LOSSLESS
;
45 err
=setsockopt(s
,0,IPN_SO_FLAGS
,&flags
,sizeof(flags
));
48 err
=setsockopt(s
,0,IPN_SO_MSGPOOLSIZE
,&size
,sizeof(size
));
51 err
=setsockopt(s
,0,IPN_SO_MODE
,&mode
,sizeof(mode
));
55 err
=bind(s
,(struct sockaddr
*)&sun
,sizeof(sun
));
59 err
=connect(s
,NULL
,0);
63 while ((len
=read(0,buf
,256)) > 0) {
64 /* err=write(s,buf,len);
66 perror("write sock"); */