src/socks_parser.c File Reference

SOCKS5 protocol parser. More...

Data Structures

struct  sxp_identify_tag
struct  sxp_request_tag
struct  sxp_transaction_tag

Typedefs

typedef enum sxp_state_tag sxp_state_e
typedef struct sxp_identify_tag sxp_identify_s
typedef struct sxp_request_tag sxp_request_s

Enumerations

enum  sxp_state_tag { SXP_STATE_NONE = 0, SXP_STATE_IDENTIFIED, SXP_STATE_REQUESTED }

Functions

sxp_transaction_ssxp_transaction_new (void)
 Create a new blank SOCKS transaction, ready for parsing.
void sxp_transaction_free (sxp_transaction_s *transaction)
 Free a transaction allocated with sxp_transaction_new().
const char * sxp_get_error (sxp_transaction_s *transaction)
 Get a description of an error that this transaction had.
sxp_feed_result_e sxp_feed (sxp_transaction_s *transaction, const h_uint8_t *data, const size_t dataLen, size_t *ate)
 Feed octets to the parser.
bool sxp_has_identify (sxp_transaction_s *transaction)
 Return whether or not we have parsed the "identify" message.
bool sxp_has_request (sxp_transaction_s *transaction)
 Return whether or not we have parsed the "request" message.

Detailed Description

SOCKS5 protocol parser.

Date:
09 Mar 2010
Author:
Zachary Sims <zacs7@users.sourceforge.net>

Module prefix: sxp_

$Id$


Typedef Documentation

typedef enum sxp_state_tag sxp_state_e

Enumeration Type Documentation

Enumerator:
SXP_STATE_NONE 
SXP_STATE_IDENTIFIED 
SXP_STATE_REQUESTED 

Function Documentation

sxp_feed_result_e sxp_feed ( sxp_transaction_s transaction,
const h_uint8_t data,
const size_t  dataLen,
size_t *  ate 
)

Feed octets to the parser.

Parameters:
transaction The transaction to fill.
data The octets.
dataLen The number of octets we can parse.
ate A pointer to a counter where the number of bytes eaten will be kept.
Returns:
a sxp_feed_result_e value.
const char* sxp_get_error ( sxp_transaction_s transaction  ) 

Get a description of an error that this transaction had.

Parameters:
transaction The transaction to return the error from.
Returns:
A string literal of the error. If there is no error descriptio NULL is returned
bool sxp_has_identify ( sxp_transaction_s transaction  ) 

Return whether or not we have parsed the "identify" message.

Parameters:
transaction The transaction to inspect.
Returns:
true if it's being parsed (and can be accessed). Otherwise, false is returned.
bool sxp_has_request ( sxp_transaction_s transaction  ) 

Return whether or not we have parsed the "request" message.

Parameters:
transaction The transaction to inspect.
Returns:
true if it's being parsed (and can be accessed). Otherwise, false is returned.
void sxp_transaction_free ( sxp_transaction_s transaction  ) 

Free a transaction allocated with sxp_transaction_new().

See also:
sxp_transaction_new()
sxp_transaction_s* sxp_transaction_new ( void   ) 

Create a new blank SOCKS transaction, ready for parsing.

See also:
sxp_transaction_free()
Returns:
A blank transaction on success. On error, NULL is returned.

Generated by  doxygen 1.6.2