return NULL;
}
-/* add a flowbit to the flow */
-static void FlowBitAdd(Flow *f, uint32_t idx)
+/** \brief add a flowbit to the flow
+ * \retval -1 error
+ * \retval 0 not added, already set before
+ * \retval 1 added */
+static int FlowBitAdd(Flow *f, uint32_t idx)
{
FlowBit *fb = FlowBitGet(f, idx);
if (fb == NULL) {
fb = SCMalloc(sizeof(FlowBit));
if (unlikely(fb == NULL))
- return;
+ return -1;
fb->type = DETECT_FLOWBITS;
fb->idx = idx;
fb->next = NULL;
GenericVarAppend(&f->flowvar, (GenericVar *)fb);
+ return 1;
+ } else {
+ return 0;
}
}
FlowBitFree(fb);
}
-void FlowBitSet(Flow *f, uint32_t idx)
+/** \brief add a flowbit to the flow
+ * \retval -1 error
+ * \retval 0 not added, already set before
+ * \retval 1 added */
+int FlowBitSet(Flow *f, uint32_t idx)
{
- FlowBitAdd(f, idx);
+ return FlowBitAdd(f, idx);
}
void FlowBitUnset(Flow *f, uint32_t idx)
void FlowBitFree(FlowBit *);
void FlowBitRegisterTests(void);
-void FlowBitSet(Flow *, uint32_t);
+int FlowBitSet(Flow *, uint32_t);
void FlowBitUnset(Flow *, uint32_t);
bool FlowBitToggle(Flow *, uint32_t);
int FlowBitIsset(Flow *, uint32_t);