codec.proto_bits |= PROTO_BIT__TCP;
}
-static void set_flags(const DAQ_SktHdr_t* pci, CodecData& codec, DecodeData& snort)
+static void set_flags(
+ const DAQ_SktHdr_t* pci, const RawData& raw, CodecData& codec, DecodeData& snort)
{
if ( pci->flags & DAQ_SKT_FLAG_TO_SERVER )
snort.decode_flags |= DECODE_C2S;
snort.decode_flags |= DECODE_SOF;
if ( pci->flags & DAQ_SKT_FLAG_END_FLOW )
+ {
snort.decode_flags |= DECODE_EOF;
-
- codec.lyr_len = 0;
+ codec.lyr_len = raw.len;
+ }
+ else
+ codec.lyr_len = 0;
}
bool SocketCodec::decode(const RawData& raw, CodecData& codec, DecodeData& snort)
snort.set_pkt_type(PktType::FILE);
}
- set_flags(pci, codec, snort);
+ set_flags(pci, raw, codec, snort);
return true;
}
impl->sock_c = impl->sock_a = impl->sock_b = -1;
}
-static int sock_recv(SockImpl* impl, int* sock, struct sockaddr_in* psin)
+static int sock_recv(SockImpl* impl, int* sock)
{
int n = recv(*sock, impl->buf, impl->snaplen, 0);
{
DPE(impl->error, "%s: can't recv from socket (%s)\n",
__FUNCTION__, strerror(errno));
- *sock = -1;
- psin->sin_addr.s_addr = 0;
- psin->sin_port = 0;
impl->pci.flags = DAQ_SKT_FLAG_END_FLOW;
+ *sock = -1;
}
return 0;
}
return 0;
else if ( *sock >= 0 && FD_ISSET(*sock, &inputs) )
- return sock_recv(impl, sock, psin);
+ return sock_recv(impl, sock);
else if ( *sock < 0 && FD_ISSET(impl->sock_c, &inputs) )
return sock_accept(impl, sock, psin);
// daq utilities
//-------------------------------------------------------------------------
+static void clear(SockImpl* impl)
+{
+ if ( impl->sock_a < 0 )
+ {
+ impl->sin_a.sin_addr.s_addr = 0;
+ impl->sin_a.sin_port = 0;
+ }
+ if ( impl->sock_b < 0 )
+ {
+ impl->sin_b.sin_addr.s_addr = 0;
+ impl->sin_b.sin_port = 0;
+ }
+}
+
static void set_pkt_hdr(SockImpl* impl, DAQ_PktHdr_t* phdr, ssize_t len)
{
struct timeval t;
impl->pci.flags |= DAQ_SKT_FLAG_TO_SERVER;
}
+ if ( impl->pci.flags & DAQ_SKT_FLAG_END_FLOW )
+ clear(impl);
+
phdr->priv_ptr = &impl->pci;
}
log_raw(p);
log_data(p->pkt, p->pkth->caplen);
}
- else if ( p->is_tcp() and p->dsize )
+ else if ( p->has_tcp_data() )
{
log_header(p);
log_data(p->data, p->dsize);
file_type_id_enabled = true;
// file_sevice_reconfig_set(true);
start_file_processing();
- LogMessage("File service: file type enabled.\n");
+ // FIXIT-L snort++ does not yet output startup configuration
+ //LogMessage("File service: file type enabled.\n");
}
if ( callback == NULL )
}
else if (file_signature_cb != cb)
{
- WarningMessage("File service: signature callback redefined.\n");
+ // FIXIT-L this should be a parse warning messgae
+ //WarningMessage("File service: signature callback redefined.\n");
}
}
file_sevice_reconfig_set(true);
#endif
start_file_processing();
- LogMessage("File service: file signature enabled.\n");
+ //LogMessage("File service: file signature enabled.\n");
}
}
#ifdef SNORT_RELOAD
file_sevice_reconfig_set(true);
#endif
- LogMessage("File service: file capture enabled.\n");
+ //LogMessage("File service: file capture enabled.\n");
/* Enable file signature*/
enable_file_signature(callback);
}
// //
//-----------------------------------------------//
-#define BUILD "153"
+#define BUILD "154"
#define NHTTP_EVENT_GEN_H
#include <assert.h>
+#include <stdio.h>
#include "events/event_queue.h"
void reset() { events_generated = 0; }
void create_event(NHttpEnums::EventSid sid)
{
+ if ( sid == NHTTP_NOT_HTTP )
+ printf("found one\n");
assert(((int)sid > 0) && ((int)sid <= 64));
if ((events_generated & (((uint64_t)1) << (sid-1))) == 0)
{