44#define EMPTY 0xFFFFFFFF
45#define PCP_INIT_SERVER_COUNT 5
52 while ((
void*)(k--) != (
void*)kd) {
75 "Malloc can't allocate enough memory for the pcp_flow.");
114#ifdef PCP_EXPERIMENTAL
121 if (f->sadscp_app_name) {
122 free(f->sadscp_app_name);
170 if ((!fkd) || (!s) || (!s->
ctx)) {
173 pcp_server_index=s->
index;
175 bucket=compute_flow_key(fkd);
178 if (((*fdb)->pcp_server_indx == pcp_server_index)
179 && (0 == memcmp(fkd, &(*fdb)->kd,
sizeof(*fkd)))) {
203 fdb=&((*fdb)->next)) {
205 (*fdb)->key_bucket=
EMPTY;
224 while (fdb != NULL) {
225 fdb_next=(fdb->
next);
226 if ((*f)(fdb, data)) {
237#ifdef PCP_EXPERIMENTAL
238void pcp_db_add_md(
pcp_flow_t *f, uint16_t md_id,
void *val,
size_t val_len)
245 for (i=f->md_val_count, md=f->md_vals; i>0 && md!=NULL; --i, ++md)
247 if (md->md_id == md_id) {
256 md = (md_val_t*) realloc(f->md_vals,
257 sizeof(f->md_vals[0])*(f->md_val_count+1));
262 md = f->md_vals + f->md_val_count++;
265 if ((val_len>0)&&(
val!=NULL)) {
266 md->val_len = val_len >
sizeof(md->val_buf) ?
267 sizeof(md->val_buf) : val_len;
268 memcpy(md->val_buf, val, md->val_len);
329#ifdef PCP_USE_IPV6_SOCKET
332 ret->
af=IN6_IS_ADDR_V4MAPPED(ip) ? AF_INET : AF_INET6;
340 createNonce(&ret->
nonce);
353 if ((pcp_server_index < 0)
404 if (IN6_ARE_ADDR_EQUAL(fd->
ip, (
struct in6_addr *) s->
pcp_ip)) {
#define assert(condition)
#define PCP_MAX_SUPPORTED_VERSION
pcp_errno pcp_db_foreach_flow(pcp_ctx_t *ctx, pcp_db_flow_iterate f, void *data)
pcp_server_t * get_pcp_server(pcp_ctx_t *ctx, int pcp_server_index)
void pcp_flow_clear_msg_buf(pcp_flow_t *f)
pcp_errno pcp_db_add_flow(pcp_flow_t *f)
pcp_errno pcp_db_foreach_server(pcp_ctx_t *ctx, pcp_db_server_iterate f, void *data)
pcp_errno pcp_db_rem_flow(pcp_flow_t *f)
pcp_flow_t * pcp_create_flow(pcp_server_t *s, struct flow_key_data *fkd)
#define PCP_INIT_SERVER_COUNT
void pcp_db_free_pcp_servers(pcp_ctx_t *ctx)
pcp_server_t * get_pcp_server_by_ip(pcp_ctx_t *ctx, struct in6_addr *ip)
pcp_flow_t * pcp_get_flow(struct flow_key_data *fkd, pcp_server_t *s)
int pcp_new_server(pcp_ctx_t *ctx, struct in6_addr *ip, uint16_t port, uint32_t scope_id)
struct find_data find_data_t
pcp_errno pcp_delete_flow_intern(pcp_flow_t *f)
int(* pcp_db_flow_iterate)(pcp_flow_t *f, void *data)
int(* pcp_db_server_iterate)(pcp_server_t *f, void *data)
pcp_errno run_server_state_machine(pcp_server_t *s, pcp_event_e event)
void pcp_strerror(int errnum, char *buf, size_t buflen)
#define PCP_LOG_END(level)
#define PCP_LOG_BEGIN(level)
#define PCP_LOG(level, fmt,...)
#define IPV6_ADDR_COPY(dest, src)
pcp_server_t * found_server
pcp_server_t * pcp_servers
size_t pcp_servers_length
pcp_flow_t * flows[FLOW_HASH_SIZE]
struct pcp_ctx_s::pcp_client_db pcp_db
pcp_flow_t * ping_flow_msg
pcp_server_state_e server_state