Annotation of embedaddon/hping2/arsglue.c, revision 1.1

1.1     ! misho       1: /* Glue between hping and the ars engine */
        !             2: 
        !             3: #include <stdlib.h>
        !             4: #include <stdio.h>
        !             5: #include "ars.h"
        !             6: 
        !             7: /* Send the APD described packet {s} */
        !             8: void hping_ars_send(char *apd)
        !             9: {
        !            10:        struct ars_packet p;
        !            11:        int s;
        !            12: 
        !            13:        ars_init(&p);
        !            14:        s = ars_open_rawsocket(&p);
        !            15:        if (s == -ARS_ERROR) {
        !            16:                perror("Opening raw socket");
        !            17:                exit(1);
        !            18:        }
        !            19:        if (ars_d_build(&p, apd) != -ARS_OK) {
        !            20:                fprintf(stderr, "APD error: %s\n", p.p_error);
        !            21:                exit(1);
        !            22:        }
        !            23:        if (ars_compile(&p) != -ARS_OK) {
        !            24:                fprintf(stderr, "APD error compiling: %s\n", p.p_error);
        !            25:                exit(1);
        !            26:        }
        !            27:        if (ars_send(s, &p, NULL, 0) != -ARS_OK) {
        !            28:                perror("Sending the packet");
        !            29:                exit(1);
        !            30:        }
        !            31:        exit(0);
        !            32: }

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