|
|
#define | HICN_DEFAULT_PORT 9695 |
| |
|
#define | HOTFIXMARGIN 0 |
| |
| #define | DEFAULT_SIZE_LOG 3 |
| | Defines the default size for the allocated data arrays holding the results of API calls. More...
|
| |
| #define | UNION_CAST(x, destType) |
| |
| #define | foreach_command |
| |
|
#define | _(x) ACTION_##x, |
| |
| #define | GENERATE_FIND_HEADER(TYPE) |
| | Find en element in the data structure. More...
|
| |
| #define | GENERATE_FIND(TYPE) |
| |
|
#define | RECV_BUFLEN 8192 |
| |
|
#define | INTERFACE_LEN 16 |
| |
|
#define | MAXSZ_HC_NAME_ SYMBOLIC_NAME_LEN |
| |
|
#define | MAXSZ_HC_NAME MAXSZ_HC_NAME_ + NULLTERM |
| |
|
#define | MAXSZ_HC_ID_ 10 /* Number of digits for MAX_INT */ |
| |
|
#define | MAXSZ_HC_ID MAXSZ_HC_ID_ + NULLTERM |
| |
| #define | foreach_type(TYPE, VAR, data) |
| |
| #define | foreach_connection_type |
| |
|
#define | _(x) CONNECTION_TYPE_##x, |
| |
|
#define | MAXSZ_HC_CONNECTION_TYPE_ 9 |
| |
|
#define | MAXSZ_HC_CONNECTION_TYPE MAXSZ_HC_CONNECTION_TYPE_ + NULLTERM + HOTFIXMARGIN |
| |
| #define | foreach_connection_state |
| |
|
#define | _(x) HC_CONNECTION_STATE_##x, |
| |
|
#define | MAXSZ_HC_CONNECTION_STATE_ 9 |
| |
|
#define | MAXSZ_HC_CONNECTION_STATE MAXSZ_HC_CONNECTION_STATE_ + NULLTERM |
| |
|
#define | foreach_listener(VAR, data) foreach_type(hc_listener_t, VAR, data) |
| |
|
#define | MAXSZ_HC_LISTENER_ INTERFACE_LEN + SPACE + MAXSZ_URL_ + SPACE + MAXSZ_HC_CONNECTION_TYPE_ |
| |
|
#define | MAXSZ_HC_LISTENER MAXSZ_HC_LISTENER_ + NULLTERM |
| |
|
#define | foreach_connection(VAR, data) foreach_type(hc_connection_t, VAR, data) |
| |
| #define | MAXSZ_HC_CONNECTION_ |
| |
|
#define | MAXSZ_HC_CONNECTION MAXSZ_HC_CONNECTION_ + NULLTERM |
| |
|
#define | foreach_face(VAR, data) foreach_type(hc_face_t, VAR, data) |
| |
|
#define | MAX_FACE_ID 255 |
| |
|
#define | MAXSZ_FACE_ID_ 3 |
| |
|
#define | MAXSZ_FACE_ID MAXSZ_FACE_ID_ + NULLTERM |
| |
|
#define | MAXSZ_FACE_NAME_ SYMBOLIC_NAME_LEN |
| |
|
#define | MAXSZ_FACE_NAME MAXSZ_FACE_NAME_ + NULLTERM |
| |
|
#define | MAXSZ_HC_FACE_ MAXSZ_FACE_ID_ + MAXSZ_FACE_NAME_ + MAXSZ_FACE_ + 5 + HOTFIXMARGIN |
| |
|
#define | MAXSZ_HC_FACE MAXSZ_HC_FACE_ + NULLTERM |
| |
|
#define | foreach_route(VAR, data) foreach_type(hc_route_t, VAR, data) |
| |
|
#define | MAX_COST 65535 |
| |
|
#define | MAXSZ_COST 5 |
| |
|
#define | MAX_LEN 255 |
| |
|
#define | MAXSZ_LEN 3 |
| |
|
#define | MAXSZ_HC_ROUTE_ MAXSZ_FACE_ID + 1 + MAXSZ_COST + 1 + MAXSZ_IP_ADDRESS + 1 + MAXSZ_LEN |
| |
|
#define | MAXSZ_HC_ROUTE MAXSZ_HC_ROUTE_ + NULLTERM |
| |
|
#define | foreach_punting(VAR, data) foreach_type(hc_punting_t, VAR, data) |
| |
|
#define | MAXSZ_HC_PUNTING_ 0 |
| |
|
#define | MAXSZ_HC_PUNTING MAXSZ_HC_PUNTING_ + NULLTERM |
| |
|
#define | MAXSZ_STRATEGY_NAME 255 |
| |
|
#define | foreach_strategy(VAR, data) foreach_type(hc_strategy_t, VAR, data) |
| |
|
#define | MAXSZ_HC_STRATEGY_ MAXSZ_STRATEGY_NAME |
| |
|
#define | MAXSZ_HC_STRATEGY MAXSZ_HC_STRATEGY_ + NULLTERM |
| |
|
| hc_data_t * | hc_data_create (size_t in_element_size, size_t out_element_size, data_callback_t complete_cb) |
| |
| void | hc_data_free (hc_data_t *data) |
| |
| int | hc_data_push_many (hc_data_t *data, const void *elements, size_t count) |
| | Adds many new results at the end of the data structure, eventually allocating buffer space for it. More...
|
| |
| int | hc_data_push (hc_data_t *data, const void *element) |
| | Adds a new result at the end of the data structure, eventually allocating buffer space for it. More...
|
| |
| int | hc_data_set_callback (hc_data_t *data, data_callback_t cb, void *cb_data) |
| | Configure a callback (along with private data) to be called upon completion of a request. More...
|
| |
| int | hc_data_set_complete (hc_data_t *data) |
| | Mark the data structure as complete. More...
|
| |
| int | hc_data_reset (hc_data_t *data) |
| | Reset the data structure holding control data. More...
|
| |
| hc_sock_t * | hc_sock_create_url (const char *url) |
| | Create an hICN control socket using the specified URL. More...
|
| |
| hc_sock_t * | hc_sock_create_forwarder (forwarder_t forwarder) |
| | Create an hICN control socket using the provided forwarder. More...
|
| |
| hc_sock_t * | hc_sock_create (void) |
| | Create an hICN control socket using the default connection type. More...
|
| |
| void | hc_sock_free (hc_sock_t *s) |
| | Frees an hICN control socket. More...
|
| |
| int | hc_sock_get_next_seq (hc_sock_t *s) |
| | Returns the next available sequence number to use for requests to the API. More...
|
| |
| int | hc_sock_set_nonblocking (hc_sock_t *s) |
| | Sets the socket as non-blocking. More...
|
| |
| int | hc_sock_get_fd (hc_sock_t *s) |
| | Return the file descriptor associated to the hICN contorl sock. More...
|
| |
| int | hc_sock_connect (hc_sock_t *s) |
| | Connect the socket. More...
|
| |
| int | hc_sock_get_available (hc_sock_t *s, u8 **buffer, size_t *size) |
| | Return the offset and size of available buffer space. More...
|
| |
| int | hc_sock_send (hc_sock_t *s, hc_msg_t *msg, size_t msglen, int seq) |
| | Write/read iexchance on the control socket (internal helper function) More...
|
| |
| int | hc_sock_recv (hc_sock_t *s) |
| | Helper for reading socket contents. More...
|
| |
| int | hc_sock_process (hc_sock_t *s, hc_data_t **data) |
| | Processing data received by socket. More...
|
| |
| int | hc_sock_callback (hc_sock_t *s, hc_data_t **data) |
| | Callback used in async mode when data is available on the socket. More...
|
| |
| int | hc_sock_reset (hc_sock_t *s) |
| | Reset the state of the sock (eg. to handle a reconnecton) More...
|
| |
|
hc_connection_type_t | connection_type_from_str (const char *str) |
| |
|
int | hc_listener_create (hc_sock_t *s, hc_listener_t *listener) |
| |
|
int | hc_listener_get (hc_sock_t *s, hc_listener_t *listener, hc_listener_t **listener_found) |
| |
|
int | hc_listener_delete (hc_sock_t *s, hc_listener_t *listener) |
| |
|
int | hc_listener_list (hc_sock_t *s, hc_data_t **pdata) |
| |
|
int | hc_listener_validate (const hc_listener_t *listener) |
| |
|
int | hc_listener_cmp (const hc_listener_t *l1, const hc_listener_t *l2) |
| |
|
int | hc_listener_parse (void *in, hc_listener_t *listener) |
| |
|
| GENERATE_FIND_HEADER (listener) |
| |
|
int | hc_listener_snprintf (char *s, size_t size, hc_listener_t *listener) |
| |
|
int | hc_connection_create (hc_sock_t *s, hc_connection_t *connection) |
| |
|
int | hc_connection_get (hc_sock_t *s, hc_connection_t *connection, hc_connection_t **connection_found) |
| |
|
int | hc_connection_update_by_id (hc_sock_t *s, int hc_connection_id, hc_connection_t *connection) |
| |
|
int | hc_connection_update (hc_sock_t *s, hc_connection_t *connection_current, hc_connection_t *connection_updated) |
| |
|
int | hc_connection_delete (hc_sock_t *s, hc_connection_t *connection) |
| |
|
int | hc_connection_list (hc_sock_t *s, hc_data_t **pdata) |
| |
|
int | hc_connection_validate (const hc_connection_t *connection) |
| |
|
int | hc_connection_cmp (const hc_connection_t *c1, const hc_connection_t *c2) |
| |
|
int | hc_connection_parse (void *in, hc_connection_t *connection) |
| |
|
int | hc_connection_set_admin_state (hc_sock_t *s, const char *conn_id_or_name, face_state_t state) |
| |
|
| GENERATE_FIND_HEADER (connection) |
| |
|
int | hc_connection_snprintf (char *s, size_t size, const hc_connection_t *connection) |
| |
| int | hc_face_create (hc_sock_t *s, hc_face_t *face) |
| | Create a face. More...
|
| |
|
int | hc_face_get (hc_sock_t *s, hc_face_t *face, hc_face_t **face_found) |
| |
|
int | hc_face_delete (hc_sock_t *s, hc_face_t *face) |
| |
|
int | hc_face_list (hc_sock_t *s, hc_data_t **pdata) |
| |
|
int | hc_face_list_async (hc_sock_t *s) |
| |
|
int | hc_face_set_admin_state (hc_sock_t *s, const char *conn_id_or_name, face_state_t state) |
| |
|
int | hc_face_snprintf (char *s, size_t size, hc_face_t *face) |
| |
|
int | hc_route_parse (void *in, hc_route_t *route) |
| |
|
int | hc_route_create (hc_sock_t *s, hc_route_t *route) |
| |
|
int | hc_route_delete (hc_sock_t *s, hc_route_t *route) |
| |
|
int | hc_route_list (hc_sock_t *s, hc_data_t **pdata) |
| |
|
int | hc_route_list_async (hc_sock_t *s) |
| |
|
int | hc_route_snprintf (char *s, size_t size, hc_route_t *route) |
| |
|
int | hc_punting_create (hc_sock_t *s, hc_punting_t *punting) |
| |
|
int | hc_punting_get (hc_sock_t *s, hc_punting_t *punting, hc_punting_t **punting_found) |
| |
|
int | hc_punting_delete (hc_sock_t *s, hc_punting_t *punting) |
| |
|
int | hc_punting_list (hc_sock_t *s, hc_data_t **pdata) |
| |
|
int | hc_punting_validate (const hc_punting_t *punting) |
| |
|
int | hc_punting_cmp (const hc_punting_t *c1, const hc_punting_t *c2) |
| |
|
int | hc_punting_parse (void *in, hc_punting_t *punting) |
| |
|
| GENERATE_FIND_HEADER (punting) |
| |
|
int | hc_punting_snprintf (char *s, size_t size, hc_punting_t *punting) |
| |
|
int | hc_cache_set_store (hc_sock_t *s, int enabled) |
| |
|
int | hc_cache_set_serve (hc_sock_t *s, int enabled) |
| |
|
int | hc_strategy_list (hc_sock_t *s, hc_data_t **data) |
| |
|
int | hc_strategy_snprintf (char *s, size_t size, hc_strategy_t *strategy) |
| |
|
int | hc_strategy_set (hc_sock_t *s) |
| |
|
int | hc_wldr_set (hc_sock_t *s) |
| |
|
int | hc_mapme_set (hc_sock_t *s, int enabled) |
| |
|
int | hc_mapme_set_discovery (hc_sock_t *s, int enabled) |
| |
|
int | hc_mapme_set_timescale (hc_sock_t *s, double timescale) |
| |
|
int | hc_mapme_set_retx (hc_sock_t *s, double timescale) |
| |
hICN control library API
This API supports basic hICN objects (face, route, punting) plus implementation-specific ones (connection, listener). Currently, this library only supports the hicn-light forwarder.
For each object, a set of methods is provided among:
- CREATE, GET, UPDATE, DELETE, LIST
- CMP, PARSE, SNPRINTF
- additionally, attribute getters and/or setters are provided and denoted GET( attribute ) and SET( attribute )
A summary per-object is presented here:
| CRE GET UPD DEL LST | VAL CMP PAR SNP | attributes [GET/SET]
+---------—+------------------—+----------—+------------------------— | face | O O ! O O | ! ! O | state [-S] | route | O - ! O O | ! O - | | punting | ! - ! ! ! | ! ! ! | +---------—+------------------—+--------------—+------------------------— | cache | | | store [!!], serve [!!] | strategy | | | | FIB | | | | PIT | | | | WLDR | | | | MAP-Me | | | +---------—+------------------—+--------------—+------------------------— | connection | O O ! O O | O O O | state [-S] | listener | O O ! O O | O O O O | +---------—+------------------—+--------------—+------------------------—
LEGEND: [O] implemented, [!] in progress / TODO, [-] not supported
NOTES:
- Different extensions of the forwarder functionalities bring both new API calls, and new object attributes. While it is expected that the former will only raised NACK answers because of unsupported API calls, the latter will certainly trigger incompatibilities. It is expected that the forwarder validates the message length and returns a NACK too. In that case, we provide a set of defines to preserve backwards compatibility. At the moment, those defines are :
WITH_POLICY: