LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/usr/local/lib/libnet11"
;;
*-*-openbsd*)
- CFLAGS="${CFLAGS} -D__OpenBSD__"
+ CFLAGS="${CFLAGS} -D__OpenBSD__ -fgnu89-inline"
CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet-1.1"
LDFLAGS="${LDFLAGS} -L/usr/local/lib -I/usr/local/lib/libnet-1.1"
;;
return p;
}
+/**
+ * \brief Copy data to Packet payload at given offset
+ *
+ * This function copies data/payload to a Packet. It uses the
+ * space allocated at Packet creation (pointed by Packet::pkt)
+ * or allocate some memory (pointed by Packet::ext_pkt) if the
+ * data size is to big to fit in initial space (of size
+ * default_packet_size).
+ *
+ * \param Pointer to the Packet to modify
+ * \param Offset of the copy relatively to payload of Packet
+ * \param Pointer to the data to copy
+ * \param Length of the data to copy
+ */
+inline int PacketCopyDataOffset(Packet *p, int offset, uint8_t *data, int datalen)
+{
+ if (offset + datalen > MAX_PAYLOAD_SIZE) {
+ /* too big */
+ return -1;
+ }
+
+ /* Do we have already an packet with allocated data */
+ if (! p->ext_pkt) {
+ if (offset + datalen <= (int)default_packet_size) {
+ /* data will fit in memory allocated with packet */
+ memcpy(p->pkt + offset, data, datalen);
+ } else {
+ /* here we need a dynamic allocation */
+ p->ext_pkt = SCMalloc(MAX_PAYLOAD_SIZE);
+ if (p->ext_pkt == NULL) {
+ SET_PKT_LEN(p, 0);
+ return -1;
+ }
+ /* copy initial data */
+ memcpy(p->ext_pkt, GET_PKT_DIRECT_DATA(p), GET_PKT_DIRECT_MAX_SIZE(p));
+ /* copy data as asked */
+ memcpy(p->ext_pkt + offset, data, datalen);
+ }
+ } else {
+ memcpy(p->ext_pkt + offset, data, datalen);
+ }
+ return 0;
+}
+
+/**
+ * \brief Copy data to Packet payload and set packet length
+ *
+ * \param Pointer to the Packet to modify
+ * \param Pointer to the data to copy
+ * \param Length of the data to copy
+ */
+inline int PacketCopyData(Packet *p, uint8_t *pktdata, int pktlen)
+{
+ SET_PKT_LEN(p, (size_t)pktlen);
+ return PacketCopyDataOffset(p, 0, pktdata, pktlen);
+}
+
+
+
/**
* \brief Setup a pseudo packet (tunnel)
*
return dtv;
}
-/**
- * \brief Copy data to Packet payload at given offset
- *
- * This function copies data/payload to a Packet. It uses the
- * space allocated at Packet creation (pointed by Packet::pkt)
- * or allocate some memory (pointed by Packet::ext_pkt) if the
- * data size is to big to fit in initial space (of size
- * default_packet_size).
- *
- * \param Pointer to the Packet to modify
- * \param Offset of the copy relatively to payload of Packet
- * \param Pointer to the data to copy
- * \param Length of the data to copy
- */
-inline int PacketCopyDataOffset(Packet *p, int offset, uint8_t *data, int datalen)
-{
- if (offset + datalen > MAX_PAYLOAD_SIZE) {
- /* too big */
- return -1;
- }
-
- /* Do we have already an packet with allocated data */
- if (! p->ext_pkt) {
- if (offset + datalen <= (int)default_packet_size) {
- /* data will fit in memory allocated with packet */
- memcpy(p->pkt + offset, data, datalen);
- } else {
- /* here we need a dynamic allocation */
- p->ext_pkt = SCMalloc(MAX_PAYLOAD_SIZE);
- if (p->ext_pkt == NULL) {
- SET_PKT_LEN(p, 0);
- return -1;
- }
- /* copy initial data */
- memcpy(p->ext_pkt, GET_PKT_DIRECT_DATA(p), GET_PKT_DIRECT_MAX_SIZE(p));
- /* copy data as asked */
- memcpy(p->ext_pkt + offset, data, datalen);
- }
- } else {
- memcpy(p->ext_pkt + offset, data, datalen);
- }
- return 0;
-}
-
-/**
- * \brief Copy data to Packet payload and set packet length
- *
- * \param Pointer to the Packet to modify
- * \param Pointer to the data to copy
- * \param Length of the data to copy
- */
-inline int PacketCopyData(Packet *p, uint8_t *pktdata, int pktlen)
-{
- SET_PKT_LEN(p, (size_t)pktlen);
- return PacketCopyDataOffset(p, 0, pktdata, pktlen);
-}
-
/**
* \brief Set data for Packet and set length when zeo copy is used
void B3gPrintSearchStats(MpmThreadCtx *);
void B3gRegisterTests(void);
-void MpmB3gRegister (void) {
- mpm_table[MPM_B3G].name = "b3g";
- mpm_table[MPM_B3G].max_pattern_length = B3G_WORD_SIZE;
- mpm_table[MPM_B3G].InitCtx = B3gInitCtx;
- mpm_table[MPM_B3G].InitThreadCtx = B3gThreadInitCtx;
- mpm_table[MPM_B3G].DestroyCtx = B3gDestroyCtx;
- mpm_table[MPM_B3G].DestroyThreadCtx = B3gThreadDestroyCtx;
- mpm_table[MPM_B3G].AddPattern = B3gAddPatternCS;
- mpm_table[MPM_B3G].AddPatternNocase = B3gAddPatternCI;
- mpm_table[MPM_B3G].Prepare = B3gPreparePatterns;
- mpm_table[MPM_B3G].Search = B3gSearchWrap;
- mpm_table[MPM_B3G].Cleanup = NULL;
- mpm_table[MPM_B3G].PrintCtx = B3gPrintInfo;
- mpm_table[MPM_B3G].PrintThreadCtx = B3gPrintSearchStats;
- mpm_table[MPM_B3G].RegisterUnittests = B3gRegisterTests;
-}
-
/** \todo XXX Unused??? */
#if 0
static void prt (uint8_t *buf, uint16_t buflen) {
return cnt;
}
+void MpmB3gRegister (void) {
+ mpm_table[MPM_B3G].name = "b3g";
+ mpm_table[MPM_B3G].max_pattern_length = B3G_WORD_SIZE;
+ mpm_table[MPM_B3G].InitCtx = B3gInitCtx;
+ mpm_table[MPM_B3G].InitThreadCtx = B3gThreadInitCtx;
+ mpm_table[MPM_B3G].DestroyCtx = B3gDestroyCtx;
+ mpm_table[MPM_B3G].DestroyThreadCtx = B3gThreadDestroyCtx;
+ mpm_table[MPM_B3G].AddPattern = B3gAddPatternCS;
+ mpm_table[MPM_B3G].AddPatternNocase = B3gAddPatternCI;
+ mpm_table[MPM_B3G].Prepare = B3gPreparePatterns;
+ mpm_table[MPM_B3G].Search = B3gSearchWrap;
+ mpm_table[MPM_B3G].Cleanup = NULL;
+ mpm_table[MPM_B3G].PrintCtx = B3gPrintInfo;
+ mpm_table[MPM_B3G].PrintThreadCtx = B3gPrintSearchStats;
+ mpm_table[MPM_B3G].RegisterUnittests = B3gRegisterTests;
+}
+
/*
* TESTS
*/
#define COUNT(counter)
#endif /* WUMANBER_COUNTERS */
-void MpmWuManberRegister (void) {
- mpm_table[MPM_WUMANBER].name = "wumanber";
- mpm_table[MPM_WUMANBER].max_pattern_length = 0;
- mpm_table[MPM_WUMANBER].InitCtx = WmInitCtx;
- mpm_table[MPM_WUMANBER].InitThreadCtx = WmThreadInitCtx;
- mpm_table[MPM_WUMANBER].DestroyCtx = WmDestroyCtx;
- mpm_table[MPM_WUMANBER].DestroyThreadCtx = WmThreadDestroyCtx;
- mpm_table[MPM_WUMANBER].AddPattern = WmAddPatternCS;
- mpm_table[MPM_WUMANBER].AddPatternNocase = WmAddPatternCI;
- mpm_table[MPM_WUMANBER].Prepare = WmPreparePatterns;
- mpm_table[MPM_WUMANBER].Search = WmSearch;
- mpm_table[MPM_WUMANBER].Cleanup = NULL;
- mpm_table[MPM_WUMANBER].PrintCtx = WmPrintInfo;
- mpm_table[MPM_WUMANBER].PrintThreadCtx = WmPrintSearchStats;
- mpm_table[MPM_WUMANBER].RegisterUnittests = WmRegisterTests;
-
- /* create table for O(1) lowercase conversion lookup */
- uint8_t c = 0;
- for ( ; c < 255; c++) {
- if (c >= 'A' && c <= 'Z')
- lowercasetable[c] = (c + ('a' - 'A'));
- else
- lowercasetable[c] = c;
- }
-}
-
void prt (uint8_t *buf, uint16_t buflen) {
uint16_t i;
}
}
+void MpmWuManberRegister (void) {
+ mpm_table[MPM_WUMANBER].name = "wumanber";
+ mpm_table[MPM_WUMANBER].max_pattern_length = 0;
+ mpm_table[MPM_WUMANBER].InitCtx = WmInitCtx;
+ mpm_table[MPM_WUMANBER].InitThreadCtx = WmThreadInitCtx;
+ mpm_table[MPM_WUMANBER].DestroyCtx = WmDestroyCtx;
+ mpm_table[MPM_WUMANBER].DestroyThreadCtx = WmThreadDestroyCtx;
+ mpm_table[MPM_WUMANBER].AddPattern = WmAddPatternCS;
+ mpm_table[MPM_WUMANBER].AddPatternNocase = WmAddPatternCI;
+ mpm_table[MPM_WUMANBER].Prepare = WmPreparePatterns;
+ mpm_table[MPM_WUMANBER].Search = WmSearch;
+ mpm_table[MPM_WUMANBER].Cleanup = NULL;
+ mpm_table[MPM_WUMANBER].PrintCtx = WmPrintInfo;
+ mpm_table[MPM_WUMANBER].PrintThreadCtx = WmPrintSearchStats;
+ mpm_table[MPM_WUMANBER].RegisterUnittests = WmRegisterTests;
+
+ /* create table for O(1) lowercase conversion lookup */
+ uint8_t c = 0;
+ for ( ; c < 255; c++) {
+ if (c >= 'A' && c <= 'Z')
+ lowercasetable[c] = (c + ('a' - 'A'));
+ else
+ lowercasetable[c] = c;
+ }
+}
+
/*
* ONLY TESTS BELOW THIS COMMENT
*/