Annotation of embedaddon/hping2/binding.c, revision 1.1.1.1
1.1 misho 1: /*
2: * $smu-mark$
3: * $name: binding.c$
4: * $author: Salvatore Sanfilippo <antirez@invece.org>$
5: * $copyright: Copyright (C) 1999 by Salvatore Sanfilippo$
6: * $license: This software is under GPL version 2 of license$
7: * $date: Fri Nov 5 11:55:46 MET 1999$
8: * $rev: 11$
9: */
10:
11: #include <stdio.h>
12: #include <time.h>
13: #include <signal.h>
14: #include <errno.h>
15:
16: #include "hping2.h"
17: #include "globals.h"
18:
19: void inc_destparm(int sid)
20: {
21: static long sec = 0;
22: static long usec = 0;
23: int *p;
24: int errno_save = errno;
25:
26: switch (ctrlzbind) {
27: case BIND_DPORT:
28: p = &dst_port;
29: break;
30: case BIND_TTL:
31: p = &src_ttl;
32: break;
33: default:
34: printf("error binding ctrl+z\n");
35: /* errno = errno_save; */
36: return;
37: }
38:
39: if ( (time(NULL) == sec) && ((get_usec() - usec) < 200000) ) {
40: if (*p > 0)
41: (*p)-=2;
42: if (*p < 0)
43: *p=0;
44: } else
45: (*p)++;
46:
47: printf("\b\b\b\b\b\b\b\b\b");
48: printf("%d: ", *p);
49: fflush(stdout);
50:
51: sec = time(NULL);
52: usec = get_usec();
53: signal(SIGTSTP, inc_destparm);
54: errno = errno_save;
55: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>