本文整理匯總了C++中D_RETURN_函數的典型用法代碼示例。如果您正苦於以下問題:C++ D_RETURN_函數的具體用法?C++ D_RETURN_怎麽用?C++ D_RETURN_使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了D_RETURN_函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: __bro_table_val_write
static int
__bro_table_val_write(BroTableVal *tbl, BroConn *bc)
{
double d = 0;
char opt = 0;
D_ENTER;
if (! __bro_mutable_val_write((BroMutableVal *) tbl, bc))
D_RETURN_(FALSE);
if (! __bro_buf_write_double(bc->tx_buf, d))
D_RETURN_(FALSE);
/* XXX For now we neever send any attributes, nor an expire expr */
if (! __bro_buf_write_char(bc->tx_buf, opt))
D_RETURN_(FALSE);
if (! __bro_buf_write_char(bc->tx_buf, opt))
D_RETURN_(FALSE);
/* How we iterate depends on whether the index type is atomic or not.
* If atomic, we use __bro_table_val_write_cb_direct(), otherwise
* we use ..._unpack(), which converts the elements of the RecordVal
* into a ListVal before sending.
*/
if (__bro_table_val_has_atomic_key(tbl))
__bro_table_foreach(tbl->table, (BroTableCallback) __bro_table_val_write_cb_direct, bc);
else
__bro_table_foreach(tbl->table, (BroTableCallback) __bro_table_val_write_cb_unpack, bc);
D_RETURN_(TRUE);
}
示例2: __bro_io_raw_queue
int
__bro_io_raw_queue(BroConn *bc, int type, uchar *data, int data_len)
{
BroMsg *msg;
int result = FALSE;
D_ENTER;
if (!bc)
D_RETURN_(FALSE);
if (! (msg = __bro_io_msg_new(type, 0)))
D_RETURN_(FALSE);
if (data_len > 0)
{
BroBuf *buf;
if (! (buf = __bro_buf_new()))
{
__bro_io_msg_free(msg);
D_RETURN_(FALSE);
}
__bro_buf_append(buf, data, data_len);
__bro_io_msg_set_cont(msg, BRO_MSG_CONT_RAW, buf);
}
result = io_msg_queue(bc, msg);
D_RETURN_(result);
}
示例3: __bro_io_msg_queue_flush
int
__bro_io_msg_queue_flush(BroConn *bc)
{
BroMsg *msg;
int result;
D_ENTER;
if (! bc)
D_RETURN_(-1);
for ( ; ; )
{
if (! io_msg_empty_tx(bc))
break;
if (! (msg = bc->msg_queue.tqh_first))
break;
if (! io_msg_fill_tx(bc, msg))
break;
TAILQ_REMOVE(&bc->msg_queue, msg, msg_queue);
__bro_io_msg_free(msg);
bc->msg_queue_len--;
bc->state->io_msg = BRO_IOMSG_WRITE;
}
result = bc->msg_queue_len;
D_RETURN_(result);
}
示例4: __bro_io_event_queue
int
__bro_io_event_queue(BroConn *bc, BroEvent *ev)
{
BroEvent *ev_copy;
BroMsg *msg;
int result;
D_ENTER;
if (!bc)
D_RETURN_(FALSE);
if (! (msg = __bro_io_msg_new(BRO_MSG_SERIAL, 0)))
D_RETURN_(FALSE);
if (! (ev_copy = __bro_event_copy(ev)))
{
D(("Could not clone event\n"));
__bro_io_msg_free(msg);
D_RETURN_(FALSE);
}
__bro_io_msg_set_cont(msg, BRO_MSG_CONT_EVENT, ev_copy);
result = io_msg_queue(bc, msg);
D_RETURN_(result);
}
示例5: __bro_list_val_write
static int
__bro_list_val_write(BroListVal *lv, BroConn *bc)
{
BroList *l;
D_ENTER;
if (! __bro_val_write((BroVal *) lv, bc))
D_RETURN_(FALSE);
if (! __bro_buf_write_char(bc->tx_buf, lv->type_tag))
D_RETURN_(FALSE);
if (! __bro_buf_write_int(bc->tx_buf, lv->len))
D_RETURN_(FALSE);
for (l = lv->list; l; l = __bro_list_next(l))
{
BroVal *val = __bro_list_data(l);
if (! __bro_sobject_serialize((BroSObject *) val, bc))
D_RETURN_(FALSE);
}
D_RETURN_(TRUE);
}
示例6: __bro_list_val_cmp
static int
__bro_list_val_cmp(BroListVal *lv1, BroListVal *lv2)
{
BroList *l1, *l2;
D_ENTER;
if (! lv1 || ! lv2)
D_RETURN_(FALSE);
if (lv1->len != lv2->len ||
lv1->type_tag != lv2->type_tag)
D_RETURN_(FALSE);
for (l1 = lv1->list, l2 = lv2->list; l1 && l2;
l1 = __bro_list_next(l1), l2 = __bro_list_next(l2))
{
if (! __bro_sobject_cmp((BroSObject*) __bro_list_data(l1),
(BroSObject*) __bro_list_data(l2)))
D_RETURN_(FALSE);
}
if (l1 || l2)
{
D(("WARNING -- list length inconsistency.\n"));
D_RETURN_(FALSE);
}
D_RETURN_(TRUE);
}
示例7: __bro_openssl_read
int
__bro_openssl_read(BroConn *bc, uchar *buf, uint buf_size)
{
int n;
D_ENTER;
/* It's important here to use <= for comparison, since, as the
* invaluable O'Reilly OpenSSL book reports, "for each of the four
* reading and writing functions, a 0 or -1 return value may or may
* not necessarily indicate that an error has occurred." This may or
* may not necessarily be indicative of the incredible PITA that
* OpenSSL is. --cpk
*/
if ( (n = BIO_read(bc->bio, buf, buf_size)) <= 0)
{
if (BIO_should_retry(bc->bio))
D_RETURN_(0);
__bro_openssl_shutdown(bc);
D(("Connection closed, BIO_read() returned %i.\n", n));
print_errors();
D_RETURN_(-1);
}
D_RETURN_(n);
}
示例8: __bro_io_packet_queue
int
__bro_io_packet_queue(BroConn *bc, BroPacket *packet)
{
BroPacket *clone;
BroMsg *msg;
int result;
D_ENTER;
if (!bc)
D_RETURN_(FALSE);
if (! (msg = __bro_io_msg_new(BRO_MSG_SERIAL, 0)))
D_RETURN_(FALSE);
if (! (clone = bro_packet_clone(packet)))
{
__bro_io_msg_free(msg);
D_RETURN_(FALSE);
}
__bro_io_msg_set_cont(msg, BRO_MSG_CONT_PACKET, clone);
result = io_msg_queue(bc, msg);
D_RETURN_(result);
}
示例9: __bro_list_val_get_length
int
__bro_list_val_get_length(BroListVal *lv)
{
D_ENTER;
if (! lv)
D_RETURN_(0);
D_RETURN_(lv->len);
}
示例10: __bro_vector_get_length
int
__bro_vector_get_length(BroVector *vec)
{
D_ENTER;
if ( ! vec )
D_RETURN_(0);
D_RETURN_(vec->length);
}
示例11: __bro_sobject_write
int
__bro_sobject_write(BroSObject *obj, BroConn *bc)
{
D_ENTER;
if (! __bro_buf_write_short(bc->tx_buf, obj->type_id))
D_RETURN_(FALSE);
D_RETURN_(TRUE);
}
示例12: __bro_sobject_cmp
int
__bro_sobject_cmp(BroSObject *obj1, BroSObject *obj2)
{
D_ENTER;
if (! obj1 || !obj2)
D_RETURN_(FALSE);
D_RETURN_(obj1->cmp(obj1, obj2));
}
示例13: __bro_sobject_hash
uint32
__bro_sobject_hash(BroSObject *obj)
{
D_ENTER;
if (! obj)
D_RETURN_(0);
D_RETURN_(obj->hash(obj));
}
示例14: __bro_id_cmp
int
__bro_id_cmp(BroID *id1, BroID *id2)
{
D_ENTER;
if (! id1 || ! id2)
D_RETURN_(FALSE);
D_RETURN_(__bro_ht_str_cmp(id1->name.str_val, id2->name.str_val));
}
示例15: __bro_list_val_get_front
BroVal *
__bro_list_val_get_front(BroListVal *lv)
{
BroVal *result;
BroList *l;
D_ENTER;
if (! lv)
D_RETURN_(NULL);
D_RETURN_((BroVal*) __bro_list_data(lv->list));
}