Project Alice
Loading...
Searching...
No Matches
pcp.h File Reference
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdint.h>
Include dependency graph for pcp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pcp_socket_vt_s
 
struct  pcp_flow_info
 

Macros

#define PCP_SOCKET   int
 
#define ENABLE_AUTODISCOVERY   1
 
#define DISABLE_AUTODISCOVERY   0
 

Typedefs

typedef void(* external_logger) (pcp_loglvl_e, const char *)
 
typedef struct pcp_flow_s pcp_flow_t
 
typedef struct pcp_ctx_s pcp_ctx_t
 
typedef struct pcp_socket_vt_s pcp_socket_vt_t
 
typedef struct pcp_flow_info pcp_flow_info_t
 
typedef void(* pcp_flow_change_notify) (pcp_flow_t *f, struct sockaddr *src_addr, struct sockaddr *ext_addr, pcp_fstate_e, void *cb_arg)
 

Enumerations

enum  pcp_errno {
  PCP_ERR_SUCCESS =0 , PCP_ERR_MAX_SIZE =-1 , PCP_ERR_OPT_ALREADY_PRESENT =-2 , PCP_ERR_BAD_AFINET =-3 ,
  PCP_ERR_SEND_FAILED =-4 , PCP_ERR_RECV_FAILED =-5 , PCP_ERR_UNSUP_VERSION =-6 , PCP_ERR_NO_MEM =-7 ,
  PCP_ERR_BAD_ARGS =-8 , PCP_ERR_UNKNOWN =-9 , PCP_ERR_SHORT_LIFETIME_ERR =-10 , PCP_ERR_TIMEOUT =-11 ,
  PCP_ERR_NOT_FOUND =-12 , PCP_ERR_WOULDBLOCK =-13 , PCP_ERR_ADDRINUSE =-14
}
 
enum  pcp_loglvl_e {
  PCP_LOGLVL_NONE =0 , PCP_LOGLVL_ERR =1 , PCP_LOGLVL_WARN =2 , PCP_LOGLVL_INFO =3 ,
  PCP_LOGLVL_PERR =4 , PCP_LOGLVL_DEBUG =5
}
 
enum  pcp_fstate_e {
  pcp_state_processing , pcp_state_succeeded , pcp_state_partial_result , pcp_state_short_lifetime_error ,
  pcp_state_failed
}
 

Functions

void pcp_set_loggerfn (external_logger ext_log)
 
pcp_ctx_tpcp_init (uint8_t autodiscovery, pcp_socket_vt_t *socket_vt)
 
int pcp_add_server (pcp_ctx_t *ctx, struct sockaddr *pcp_server, uint8_t pcp_version)
 
void pcp_terminate (pcp_ctx_t *ctx, int close_flows)
 
pcp_flow_tpcp_new_flow (pcp_ctx_t *ctx, struct sockaddr *src_addr, struct sockaddr *dst_addr, struct sockaddr *ext_addr, uint8_t protocol, uint32_t lifetime, void *userdata)
 
void pcp_flow_set_lifetime (pcp_flow_t *f, uint32_t lifetime)
 
void pcp_flow_set_user_data (pcp_flow_t *f, void *userdata)
 
void * pcp_flow_get_user_data (pcp_flow_t *f)
 
void pcp_flow_set_3rd_party_opt (pcp_flow_t *f, struct sockaddr *thirdp_addr)
 
void pcp_flow_set_filter_opt (pcp_flow_t *f, struct sockaddr *filter_ip, uint8_t filter_prefix)
 
void pcp_flow_set_prefer_failure_opt (pcp_flow_t *f)
 
void pcp_close_flow (pcp_flow_t *f)
 
void pcp_delete_flow (pcp_flow_t *f)
 
pcp_flow_info_tpcp_flow_get_info (pcp_flow_t *f, size_t *info_count)
 
void pcp_set_flow_change_cb (pcp_ctx_t *ctx, pcp_flow_change_notify cb_fun, void *cb_arg)
 
int pcp_eval_flow_state (pcp_flow_t *flow, pcp_fstate_e *fstate)
 
int pcp_pulse (pcp_ctx_t *ctx, struct timeval *next_timeout)
 
PCP_SOCKET pcp_get_socket (pcp_ctx_t *ctx)
 
pcp_fstate_e pcp_wait (pcp_flow_t *flow, int timeout, int exit_on_partial_res)
 

Variables

pcp_loglvl_e pcp_log_level
 

Macro Definition Documentation

◆ DISABLE_AUTODISCOVERY

#define DISABLE_AUTODISCOVERY   0

Definition at line 121 of file pcp.h.

◆ ENABLE_AUTODISCOVERY

#define ENABLE_AUTODISCOVERY   1

Definition at line 120 of file pcp.h.

◆ PCP_SOCKET

#define PCP_SOCKET   int

Definition at line 55 of file pcp.h.

Typedef Documentation

◆ external_logger

typedef void(* external_logger) (pcp_loglvl_e, const char *)

Definition at line 93 of file pcp.h.

◆ pcp_ctx_t

typedef struct pcp_ctx_s pcp_ctx_t

Definition at line 101 of file pcp.h.

◆ pcp_flow_change_notify

typedef void(* pcp_flow_change_notify) (pcp_flow_t *f, struct sockaddr *src_addr, struct sockaddr *ext_addr, pcp_fstate_e, void *cb_arg)

Definition at line 259 of file pcp.h.

◆ pcp_flow_info_t

◆ pcp_flow_t

typedef struct pcp_flow_s pcp_flow_t

Definition at line 100 of file pcp.h.

◆ pcp_socket_vt_t

Enumeration Type Documentation

◆ pcp_errno

enum pcp_errno
Enumerator
PCP_ERR_SUCCESS 
PCP_ERR_MAX_SIZE 
PCP_ERR_OPT_ALREADY_PRESENT 
PCP_ERR_BAD_AFINET 
PCP_ERR_SEND_FAILED 
PCP_ERR_RECV_FAILED 
PCP_ERR_UNSUP_VERSION 
PCP_ERR_NO_MEM 
PCP_ERR_BAD_ARGS 
PCP_ERR_UNKNOWN 
PCP_ERR_SHORT_LIFETIME_ERR 
PCP_ERR_TIMEOUT 
PCP_ERR_NOT_FOUND 
PCP_ERR_WOULDBLOCK 
PCP_ERR_ADDRINUSE 

Definition at line 65 of file pcp.h.

◆ pcp_fstate_e

Enumerator
pcp_state_processing 
pcp_state_succeeded 
pcp_state_partial_result 
pcp_state_short_lifetime_error 
pcp_state_failed 

Definition at line 231 of file pcp.h.

◆ pcp_loglvl_e

Enumerator
PCP_LOGLVL_NONE 
PCP_LOGLVL_ERR 
PCP_LOGLVL_WARN 
PCP_LOGLVL_INFO 
PCP_LOGLVL_PERR 
PCP_LOGLVL_DEBUG 

Definition at line 84 of file pcp.h.

Function Documentation

◆ pcp_add_server()

int pcp_add_server ( pcp_ctx_t ctx,
struct sockaddr *  pcp_server,
uint8_t  pcp_version 
)

Definition at line 72 of file pcp_api.c.

Here is the call graph for this function:

◆ pcp_close_flow()

void pcp_close_flow ( pcp_flow_t f)

Definition at line 626 of file pcp_api.c.

Here is the call graph for this function:

◆ pcp_delete_flow()

void pcp_delete_flow ( pcp_flow_t f)

Definition at line 639 of file pcp_api.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pcp_eval_flow_state()

int pcp_eval_flow_state ( pcp_flow_t flow,
pcp_fstate_e fstate 
)

Definition at line 136 of file pcp_api.c.

Here is the caller graph for this function:

◆ pcp_flow_get_info()

pcp_flow_info_t * pcp_flow_get_info ( pcp_flow_t f,
size_t *  info_count 
)

Definition at line 669 of file pcp_api.c.

◆ pcp_flow_get_user_data()

void * pcp_flow_get_user_data ( pcp_flow_t f)

Definition at line 745 of file pcp_api.c.

◆ pcp_flow_set_3rd_party_opt()

void pcp_flow_set_3rd_party_opt ( pcp_flow_t f,
struct sockaddr *  thirdp_addr 
)

Definition at line 500 of file pcp_api.c.

Here is the call graph for this function:

◆ pcp_flow_set_filter_opt()

void pcp_flow_set_filter_opt ( pcp_flow_t f,
struct sockaddr *  filter_ip,
uint8_t  filter_prefix 
)

Definition at line 511 of file pcp_api.c.

Here is the call graph for this function:

◆ pcp_flow_set_lifetime()

void pcp_flow_set_lifetime ( pcp_flow_t f,
uint32_t  lifetime 
)

Definition at line 489 of file pcp_api.c.

Here is the call graph for this function:

◆ pcp_flow_set_prefer_failure_opt()

void pcp_flow_set_prefer_failure_opt ( pcp_flow_t f)

Definition at line 526 of file pcp_api.c.

Here is the call graph for this function:

◆ pcp_flow_set_user_data()

void pcp_flow_set_user_data ( pcp_flow_t f,
void *  userdata 
)

Definition at line 735 of file pcp_api.c.

◆ pcp_get_socket()

PCP_SOCKET pcp_get_socket ( pcp_ctx_t ctx)

Definition at line 66 of file pcp_api.c.

Here is the caller graph for this function:

◆ pcp_init()

pcp_ctx_t * pcp_init ( uint8_t  autodiscovery,
pcp_socket_vt_t socket_vt 
)

Definition at line 93 of file pcp_api.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pcp_new_flow()

pcp_flow_t * pcp_new_flow ( pcp_ctx_t ctx,
struct sockaddr *  src_addr,
struct sockaddr *  dst_addr,
struct sockaddr *  ext_addr,
uint8_t  protocol,
uint32_t  lifetime,
void *  userdata 
)

Definition at line 389 of file pcp_api.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pcp_pulse()

int pcp_pulse ( pcp_ctx_t ctx,
struct timeval *  next_timeout 
)

Definition at line 1087 of file pcp_event_handler.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pcp_set_flow_change_cb()

void pcp_set_flow_change_cb ( pcp_ctx_t ctx,
pcp_flow_change_notify  cb_fun,
void *  cb_arg 
)

Definition at line 1168 of file pcp_event_handler.c.

◆ pcp_set_loggerfn()

void pcp_set_loggerfn ( external_logger  ext_log)

Definition at line 107 of file pcp_logger.c.

◆ pcp_terminate()

void pcp_terminate ( pcp_ctx_t ctx,
int  close_flows 
)

Definition at line 662 of file pcp_api.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pcp_wait()

pcp_fstate_e pcp_wait ( pcp_flow_t flow,
int  timeout,
int  exit_on_partial_res 
)

Definition at line 187 of file pcp_api.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ pcp_log_level

pcp_loglvl_e pcp_log_level
extern

Definition at line 48 of file pcp_logger.c.