dma: rework config parsing
[dragonfly.git] / contrib / ipfilter / ipsend / hpux.c
blob463fdbfdafffc506b6564d05651ec130848684ca
1 /*
2 * (C)opyright 1997-1998 Darren Reed. (from tcplog)
4 * See the IPFILTER.LICENCE file for details on licencing.
5 */
6 #include <stdio.h>
7 #include <strings.h>
8 #include <unistd.h>
9 #include <stdlib.h>
10 #include <sys/types.h>
11 #include <sys/param.h>
12 #include <sys/socket.h>
13 #include <sys/file.h>
14 #include <sys/ioctl.h>
17 int initdevice(device, sport, tout)
18 char *device;
19 int sport, tout;
21 int fd;
23 if ((fd = socket(AF_DLI, SOCK_RAW, 0)) == -1)
24 perror("socket");
25 return fd;
30 * output an IP packet onto a fd opened for /dev/bpf
32 int sendip(fd, pkt, len)
33 int fd, len;
34 char *pkt;
36 if (send(fd, pkt, len, 0) == -1)
38 perror("send");
39 return -1;
42 return len;
46 char *strdup(str)
47 char *str;
49 char *s;
51 if ((s = (char *)malloc(strlen(str) + 1)))
52 return strcpy(s, str);
53 return NULL;
56 * (C)opyright 1997 Darren Reed. (from tcplog)
58 * Redistribution and use in source and binary forms are permitted
59 * provided that this notice is preserved and due credit is given
60 * to the original author and the contributors.
62 #include <stdio.h>
63 #include <strings.h>
64 #include <unistd.h>
65 #include <stdlib.h>
66 #include <sys/types.h>
67 #include <sys/param.h>
68 #include <sys/socket.h>
69 #include <sys/file.h>
70 #include <sys/ioctl.h>
73 int initdevice(device, sport, tout)
74 char *device;
75 int sport, tout;
77 int fd;
79 if ((fd = socket(AF_DLI, SOCK_RAW, 0)) == -1)
80 perror("socket");
81 return fd;
86 * output an IP packet onto a fd opened for /dev/bpf
88 int sendip(fd, pkt, len)
89 int fd, len;
90 char *pkt;
92 if (send(fd, pkt, len, 0) == -1)
94 perror("send");
95 return -1;
98 return len;
102 char *strdup(str)
103 char *str;
105 char *s;
107 if ((s = (char *)malloc(strlen(str) + 1)))
108 return strcpy(s, str);
109 return NULL;