File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / hping2 / arsglue.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 22:11:37 2012 UTC (12 years, 3 months ago) by misho
Branches: hping2, MAIN
CVS tags: v2_0_0rc3p7, v2_0_0rc3p5, v2_0_0rc3p4, v2_0_0rc3p0, v2_0_0rc3, HEAD
hping2

/* Glue between hping and the ars engine */

#include <stdlib.h>
#include <stdio.h>
#include "ars.h"

/* Send the APD described packet {s} */
void hping_ars_send(char *apd)
{
	struct ars_packet p;
	int s;

	ars_init(&p);
	s = ars_open_rawsocket(&p);
	if (s == -ARS_ERROR) {
		perror("Opening raw socket");
		exit(1);
	}
	if (ars_d_build(&p, apd) != -ARS_OK) {
		fprintf(stderr, "APD error: %s\n", p.p_error);
		exit(1);
	}
	if (ars_compile(&p) != -ARS_OK) {
		fprintf(stderr, "APD error compiling: %s\n", p.p_error);
		exit(1);
	}
	if (ars_send(s, &p, NULL, 0) != -ARS_OK) {
		perror("Sending the packet");
		exit(1);
	}
	exit(0);
}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>