Tor  0.4.3.0-alpha-dev
Functions
proto_cell.c File Reference

Decodes Tor cells from buffers. More...

#include "core/or/or.h"
#include "lib/buf/buffers.h"
#include "core/proto/proto_cell.h"
#include "core/or/connection_or.h"
#include "core/or/var_cell_st.h"

Go to the source code of this file.

Functions

static int cell_command_is_var_length (uint8_t command, int linkproto)
 
int fetch_var_cell_from_buf (buf_t *buf, var_cell_t **out, int linkproto)
 

Detailed Description

Decodes Tor cells from buffers.

Definition in file proto_cell.c.

Function Documentation

◆ cell_command_is_var_length()

static int cell_command_is_var_length ( uint8_t  command,
int  linkproto 
)
inlinestatic

True iff the cell command command is one that implies a variable-length cell in Tor link protocol linkproto.

Definition at line 25 of file proto_cell.c.

◆ fetch_var_cell_from_buf()

int fetch_var_cell_from_buf ( buf_t *  buf,
var_cell_t **  out,
int  linkproto 
)

Check buf for a variable-length cell according to the rules of link protocol version linkproto. If one is found, pull it off the buffer and assign a newly allocated var_cell_t to *out, and return 1. Return 0 if whatever is on the start of buf_t is not a variable-length cell. Return 1 and set *out to NULL if there seems to be the start of a variable-length cell on buf, but the whole thing isn't there yet.

Definition at line 57 of file proto_cell.c.

Referenced by connection_fetch_var_cell_from_buf().