Annotation of embedaddon/hping2/datahandler.c, revision 1.1
1.1 ! misho 1: /*
! 2: * $smu-mark$
! 3: * $name: datahandler.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:47 MET 1999$
! 8: * $rev: 8$
! 9: */
! 10:
! 11: #include <string.h>
! 12:
! 13: #include "hping2.h"
! 14: #include "globals.h"
! 15:
! 16: void data_handler(char *data, int data_size)
! 17: {
! 18: if (opt_listenmode) { /* send an HCMP */
! 19: memcpy(data, rsign, signlen); /* ok, write own reverse sign */
! 20: data+=signlen;
! 21: data_size-=signlen;
! 22: memcpy(data, hcmphdr_p, data_size);
! 23: return; /* done */
! 24: }
! 25:
! 26: if (opt_sign) {
! 27: memcpy(data, sign, signlen); /* lenght pre-checked */
! 28: data+=signlen;
! 29: data_size-=signlen;
! 30: }
! 31:
! 32: if (data_size == 0)
! 33: return; /* there is not space left */
! 34:
! 35: if (opt_datafromfile)
! 36: datafiller(data, data_size);
! 37: else
! 38: memset(data, 'X', data_size);
! 39: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>