evtag(3)

evtag(3) | Library Functions Manual | evtag(3)

# NAME

evtag - Helper functions for reading and writing tagged data onto buffers.

# SYNOPSIS

#include <event2/tag.h>
#include <event2/visibility.h>
#include <event2/event-config.h>
#include <event2/util.h>

## Functions

EVENT2_EXPORT_SYMBOL int evtag_consume (struct evbuffer *evbuf)
EVENT2_EXPORT_SYMBOL void evtag_encode_int (struct evbuffer *evbuf, ev_uint32_t number)
Encode an integer and store it in an evbuffer. EVENT2_EXPORT_SYMBOL void evtag_encode_int64 (struct evbuffer *evbuf, ev_uint64_t number)
EVENT2_EXPORT_SYMBOL void evtag_init (void)
EVENT2_EXPORT_SYMBOL void evtag_marshal (struct evbuffer *evbuf, ev_uint32_t tag, const void *data, ev_uint32_t len)
EVENT2_EXPORT_SYMBOL void evtag_marshal_buffer (struct evbuffer *evbuf, ev_uint32_t tag, struct evbuffer *data)
EVENT2_EXPORT_SYMBOL void evtag_marshal_int (struct evbuffer *evbuf, ev_uint32_t tag, ev_uint32_t integer)
EVENT2_EXPORT_SYMBOL void evtag_marshal_int64 (struct evbuffer *evbuf, ev_uint32_t tag, ev_uint64_t integer)
EVENT2_EXPORT_SYMBOL void evtag_marshal_string (struct evbuffer *buf, ev_uint32_t tag, const char *string)
EVENT2_EXPORT_SYMBOL void evtag_marshal_timeval (struct evbuffer *evbuf, ev_uint32_t tag, struct timeval *tv)
EVENT2_EXPORT_SYMBOL int evtag_payload_length (struct evbuffer *evbuf, ev_uint32_t *plength)
EVENT2_EXPORT_SYMBOL int evtag_peek (struct evbuffer *evbuf, ev_uint32_t *ptag)
EVENT2_EXPORT_SYMBOL int evtag_peek_length (struct evbuffer *evbuf, ev_uint32_t *plength)
EVENT2_EXPORT_SYMBOL int evtag_unmarshal (struct evbuffer *src, ev_uint32_t *ptag, struct evbuffer *dst)
EVENT2_EXPORT_SYMBOL int evtag_unmarshal_fixed (struct evbuffer *src, ev_uint32_t need_tag, void *data, size_t len)
EVENT2_EXPORT_SYMBOL int evtag_unmarshal_header (struct evbuffer *evbuf, ev_uint32_t *ptag)
Unmarshals the header and returns the length of the payload. EVENT2_EXPORT_SYMBOL int evtag_unmarshal_int (struct evbuffer *evbuf, ev_uint32_t need_tag, ev_uint32_t *pinteger)
EVENT2_EXPORT_SYMBOL int evtag_unmarshal_int64 (struct evbuffer *evbuf, ev_uint32_t need_tag, ev_uint64_t *pinteger)
EVENT2_EXPORT_SYMBOL int evtag_unmarshal_string (struct evbuffer *evbuf, ev_uint32_t need_tag, char **pstring)
EVENT2_EXPORT_SYMBOL int evtag_unmarshal_timeval (struct evbuffer *evbuf, ev_uint32_t need_tag, struct timeval *ptv)

# Detailed Description

Helper functions for reading and writing tagged data onto buffers.

# Function Documentation

## EVENT2_EXPORT_SYMBOL void evtag_encode_int (struct evbuffer * evbuf, ev_uint32_t number)

Encode an integer and store it in an evbuffer. We encode integers by nybbles; the first nibble contains the number of significant nibbles - 1; this allows us to encode up to 64-bit integers. This function is byte-order independent.

Parameters:

evbuf evbuffer to store the encoded number
number a 32-bit integer

## EVENT2_EXPORT_SYMBOL int evtag_unmarshal_header (struct evbuffer * evbuf, ev_uint32_t * ptag)

Unmarshals the header and returns the length of the payload.

Parameters:

evbuf the buffer from which to unmarshal data
ptag a pointer in which the tag id is being stored

Returns:

-1 on failure or the number of bytes in the remaining payload.

# Author

Generated automatically by Doxygen for libevent from the source code.

Tue Jan 31 2017 | libevent