1/* $FreeBSD: head/contrib/ipfilter/tools/ipsyncm.c 161357 2006-08-16 12:23:02Z guido $ */ |
2 3/* 4 * Copyright (C) 1993-2001 by Darren Reed. 5 * 6 * See the IPFILTER.LICENCE file for details on licencing. 7 */ 8#if !defined(lint) 9static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-2000 Darren Reed"; |
10static const char rcsid[] = "@(#)$Id: ipsyncm.c,v 1.4.2.4 2006/03/27 02:09:46 darrenr Exp $"; |
11#endif 12#include <sys/types.h> 13#include <sys/time.h> 14#include <sys/socket.h> 15 16#include <netinet/in.h> 17#include <net/if.h> 18 19#include <arpa/inet.h> 20 21#include <stdio.h> 22#include <stdlib.h> 23#include <fcntl.h> 24#include <unistd.h> |
25#include |
26#include <syslog.h> 27#include <signal.h> 28 29#include "netinet/ip_compat.h" 30#include "netinet/ip_fil.h" 31#include "netinet/ip_nat.h" 32#include "netinet/ip_state.h" 33#include "netinet/ip_sync.h" 34 35 36int main __P((int, char *[])); |
37void usage __P((const char *)); |
38 39int terminate = 0; 40 41void usage(const char *progname) { 42 fprintf(stderr, "Usage: %s <destination IP> <destination port>\n", progname); 43} 44 |
45#if 0 |
46static void handleterm(int sig) 47{ 48 terminate = sig; 49} |
50#endif |
51 52 53/* should be large enough to hold header + any datatype */ 54#define BUFFERLEN 1400 55 56int main(argc, argv) 57int argc; 58char *argv[]; --- 56 unchanged lines hidden (view full) --- 115 goto tryagain; 116 } 117 118 if (connect(nfd, (struct sockaddr *)&sin, sizeof(sin)) == -1) { 119 syslog(LOG_ERR, "Connect: %m"); 120 goto tryagain; 121 } 122 |
123 syslog(LOG_INFO, "Sending data to %s", |
124 inet_ntoa(sin.sin_addr)); 125 126 inbuf = 0; 127 while (1) { 128 129 n1 = read(lfd, buff+inbuf, BUFFERLEN-inbuf); 130 131 printf("header : %d bytes read (header = %d bytes)\n", --- 125 unchanged lines hidden --- |