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/event-config.h>
#include <event2/util.h>

## Functions

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

## void evtag_encode_int (struct evbuffer *evbuf, ev_uint32_tnumber)

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

## 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.

Wed Apr 10 2013 | libevent