From 1031a0cfba32dab6d540424843b295fd06c91dfe Mon Sep 17 00:00:00 2001 From: laforge Date: Sat, 24 Jul 2004 15:40:23 +0000 Subject: sume of the BASE stuff (the part dealing with OOB) doesn't belong in a generic packet interpreter but is rather specific to the ULOG input plugin. --- filter/raw2packet/ulogd_raw2packet_BASE.c | 129 ------------------------------ 1 file changed, 129 deletions(-) (limited to 'filter') diff --git a/filter/raw2packet/ulogd_raw2packet_BASE.c b/filter/raw2packet/ulogd_raw2packet_BASE.c index 2cc733a..ff60105 100644 --- a/filter/raw2packet/ulogd_raw2packet_BASE.c +++ b/filter/raw2packet/ulogd_raw2packet_BASE.c @@ -40,135 +40,6 @@ #include #include -/*********************************************************************** - * Raw header - ***********************************************************************/ -static ulog_iret_t raw_rets[] = { - { - .type = ULOGD_RET_STRING, - .flags = ULOGD_RETF_FREE, - .name = "raw.mac", - }, - { - .type = ULOGD_RET_RAW, - .flags = ULOGD_RETF_NONE, - .name = "raw.pkt", - }, - { - .type = ULOGD_RET_UINT32, - .flags = ULOGD_RETF_NONE, - .name = "raw.pktlen", - .ipfix = { .vendor = 0, .field_id = 1 }, - }, - { - .type = ULOGD_RET_UINT32, - .flags = ULOGD_RETF_NONE, - .name = "raw.pktcount", - .ipfix = { .vendor = 0, .field_id = 2 }, - }, -}; - -static ulog_iret_t *_interp_raw(ulog_interpreter_t *ip, - ulog_packet_msg_t *pkt) -{ - unsigned char *p; - int i; - char *buf, *oldbuf = NULL; - ulog_iret_t *ret = ip->result; - - if (pkt->mac_len) { - buf = (char *) malloc(3 * pkt->mac_len + 1); - if (!buf) { - ulogd_log(ULOGD_ERROR, "OOM!!!\n"); - return NULL; - } - *buf = '\0'; - - p = pkt->mac; - oldbuf = buf; - for (i = 0; i < pkt->mac_len; i++, p++) - sprintf(buf, "%s%02x%c", oldbuf, *p, i==pkt->mac_len-1 ? ' ':':'); - ret[0].value.ptr = buf; - ret[0].flags |= ULOGD_RETF_VALID; - } - - /* include pointer to raw ipv4 packet */ - ret[1].value.ptr = pkt->payload; - ret[1].flags |= ULOGD_RETF_VALID; - ret[2].value.ui32 = pkt->data_len; - ret[2].flags |= ULOGD_RETF_VALID; - ret[3].value.ui32 = 1; - ret[3].flags |= ULOGD_RETF_VALID; - - return ret; -} - -/*********************************************************************** - * OUT OF BAND - ***********************************************************************/ - -static ulog_iret_t oob_rets[] = { - { - .type = ULOGD_RET_STRING, - .flags = ULOGD_RETF_NONE, - .name = "oob.prefix", - }, - { .type = ULOGD_RET_UINT32, - .flags = ULOGD_RETF_NONE, - .name = "oob.time.sec", - .ipfix = { .vendor = 0, .field_id = 22 }, - }, - { - .type = ULOGD_RET_UINT32, - .flags = ULOGD_RETF_NONE, - .name = "oob.time.usec", - }, - { - .type = ULOGD_RET_UINT32, - .flags = ULOGD_RETF_NONE, - .name = "oob.mark", - }, - { - .type = ULOGD_RET_STRING, - .flags = ULOGD_RETF_NONE, - .name = "oob.in", - }, - { - .type = ULOGD_RET_STRING, - .flags = ULOGD_RETF_NONE, - .name = "oob.out", - }, -}; - -static ulog_iret_t *_interp_oob(struct ulog_interpreter *ip, - ulog_packet_msg_t *pkt) -{ - ulog_iret_t *ret = ip->result; - - ret[0].value.ptr = pkt->prefix; - ret[0].flags |= ULOGD_RETF_VALID; - - /* god knows why timestamp_usec contains crap if timestamp_sec == 0 - * if (pkt->timestamp_sec || pkt->timestamp_usec) { */ - if (pkt->timestamp_sec) { - ret[1].value.ui32 = pkt->timestamp_sec; - ret[1].flags |= ULOGD_RETF_VALID; - ret[2].value.ui32 = pkt->timestamp_usec; - ret[2].flags |= ULOGD_RETF_VALID; - } else { - ret[1].flags &= ~ULOGD_RETF_VALID; - ret[2].flags &= ~ULOGD_RETF_VALID; - } - - ret[3].value.ui32 = pkt->mark; - ret[3].flags |= ULOGD_RETF_VALID; - ret[4].value.ptr = pkt->indev_name; - ret[4].flags |= ULOGD_RETF_VALID; - ret[5].value.ptr = pkt->outdev_name; - ret[5].flags |= ULOGD_RETF_VALID; - - return ret; -} /*********************************************************************** * IP HEADER -- cgit v1.2.3