Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / ipf / ipsend / hpux.c
blob69f962c77c134b764fc7df78f15af7397cb7dcdc
1 /* $NetBSD$ */
3 /*
4 * (C)opyright 1997-1998 Darren Reed. (from tcplog)
6 * Redistribution and use in source and binary forms are permitted
7 * provided that this notice is preserved and due credit is given
8 * to the original author and the contributors.
9 */
10 #include <stdio.h>
11 #include <strings.h>
12 #include <unistd.h>
13 #include <stdlib.h>
14 #include <sys/types.h>
15 #include <sys/param.h>
16 #include <sys/socket.h>
17 #include <sys/file.h>
18 #include <sys/ioctl.h>
21 int initdevice(device, sport, tout)
22 char *device;
23 int sport, tout;
25 int fd;
27 if ((fd = socket(AF_DLI, SOCK_RAW, 0)) == -1)
28 perror("socket");
29 return fd;
34 * output an IP packet onto a fd opened for /dev/bpf
36 int sendip(fd, pkt, len)
37 int fd, len;
38 char *pkt;
40 if (send(fd, pkt, len, 0) == -1)
42 perror("send");
43 return -1;
46 return len;
50 char *strdup(str)
51 char *str;
53 char *s;
55 if ((s = (char *)malloc(strlen(str) + 1)))
56 return strcpy(s, str);
57 return NULL;
60 * (C)opyright 1997 Darren Reed. (from tcplog)
62 * Redistribution and use in source and binary forms are permitted
63 * provided that this notice is preserved and due credit is given
64 * to the original author and the contributors.
66 #include <stdio.h>
67 #include <strings.h>
68 #include <unistd.h>
69 #include <stdlib.h>
70 #include <sys/types.h>
71 #include <sys/param.h>
72 #include <sys/socket.h>
73 #include <sys/file.h>
74 #include <sys/ioctl.h>
77 int initdevice(device, sport, tout)
78 char *device;
79 int sport, tout;
81 int fd;
83 if ((fd = socket(AF_DLI, SOCK_RAW, 0)) == -1)
84 perror("socket");
85 return fd;
90 * output an IP packet onto a fd opened for /dev/bpf
92 int sendip(fd, pkt, len)
93 int fd, len;
94 char *pkt;
96 if (send(fd, pkt, len, 0) == -1)
98 perror("send");
99 return -1;
102 return len;
106 char *strdup(str)
107 char *str;
109 char *s;
111 if ((s = (char *)malloc(strlen(str) + 1)))
112 return strcpy(s, str);
113 return NULL;