Hybrid ICN (hICN) plugin  v21.06-rc0-4-g18fa668
api.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2020 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
65 #ifndef HICNTRL_API
66 #define HICNTRL_API
67 
68 #include <stdbool.h>
69 #include <stdint.h>
70 
71 #include <hicn/util/ip_address.h>
72 #include <hicn/ctrl/commands.h>
73 #include "face.h"
74 
75 #define HICN_DEFAULT_PORT 9695
76 
77 #define HOTFIXMARGIN 0
78 
87 #define DEFAULT_SIZE_LOG 3
88 
89 /* Helper for avoiding warnings about type-punning */
90 #ifndef UNION_CAST
91 #define UNION_CAST(x, destType) \
92  (((union { \
93  __typeof__(x) a; \
94  destType b; \
95  })x) \
96  .b)
97 #endif
98 /******************************************************************************
99  * Message helper types and aliases
100  ******************************************************************************/
101 
102 #define foreach_command \
103  _(UNDEFINED) \
104  _(CREATE) \
105  _(UPDATE) \
106  _(DELETE) \
107  _(LIST) \
108  _(SET) \
109  _(N)
110 
111 typedef enum {
112 #define _(x) ACTION_##x,
113  foreach_command
114 #undef _
115 } hc_action_t;
116 
120 typedef struct hc_msg_s hc_msg_t;
121 
122 /******************************************************************************
123  * Control Data
124  ******************************************************************************/
125 
126 struct hc_data_s;
127 typedef int (*data_callback_t)(struct hc_data_s *, void *);
128 
132 typedef struct hc_data_s {
133  size_t size;
134  size_t current;
135  size_t max_size_log;
136  size_t in_element_size;
137  size_t out_element_size;
139  u8 *buffer;
140  bool complete;
141 
142  /* Callbacks */
143  data_callback_t complete_cb; // XXX int (*complete_cb)(struct hc_data_s * data);
144  void *complete_cb_data;
145  int ret;
146 } hc_data_t;
147 
152 hc_data_t *hc_data_create(size_t in_element_size, size_t out_element_size, data_callback_t complete_cb);
153 
158 void hc_data_free(hc_data_t *data);
159 
171 int hc_data_push_many(hc_data_t *data, const void *elements, size_t count);
172 
183 int hc_data_push(hc_data_t *data, const void *element);
184 
192 int hc_data_set_callback(hc_data_t *data, data_callback_t cb, void *cb_data);
193 
202 
208 int hc_data_reset(hc_data_t *data);
209 
217 #define GENERATE_FIND_HEADER(TYPE) \
218 int \
219 hc_ ## TYPE ## _find(hc_data_t * data, const hc_ ## TYPE ## _t * element, \
220  hc_ ## TYPE ## _t **found)
221 
222 #define GENERATE_FIND(TYPE) \
223 int \
224 hc_ ## TYPE ## _find(hc_data_t * data, const hc_ ## TYPE ## _t * element, \
225  hc_ ## TYPE ## _t **found) \
226 { \
227  foreach_type(hc_ ## TYPE ## _t, x, data) { \
228  if (hc_ ## TYPE ## _cmp(x, element) == 0) { \
229  *found = x; \
230  return 0; \
231  } \
232  }; \
233  *found = NULL; /* this is optional */ \
234  return 0; \
235 }
236 
237 /******************************************************************************
238  * Control socket
239  ******************************************************************************/
240 
241 /* This should be at least equal to the maximum packet size */
242 #define RECV_BUFLEN 8192
243 
244 typedef enum {
245  HICNLIGHT,
246  VPP,
247  UNDEFINED
248 } forwarder_t;
249 
253 typedef struct hc_sock_s hc_sock_t;
254 
260 hc_sock_t *
261 hc_sock_create_url(const char * url);
262 
267 hc_sock_t *
268 hc_sock_create_forwarder(forwarder_t forwarder);
269 
274 hc_sock_t *
275 hc_sock_create(void);
276 
281 void hc_sock_free(hc_sock_t *s);
282 
289 
296 
303 int hc_sock_get_fd(hc_sock_t *s);
304 
309 int hc_sock_connect(hc_sock_t *s);
310 
318 int hc_sock_get_available(hc_sock_t *s, u8 **buffer, size_t *size);
319 
327 int hc_sock_send(hc_sock_t *s, hc_msg_t *msg, size_t msglen, int seq);
328 
334 int hc_sock_recv(hc_sock_t *s);
335 
343 int hc_sock_process(hc_sock_t *s, hc_data_t **data);
344 
350 int hc_sock_callback(hc_sock_t *s, hc_data_t **data);
351 
357 int hc_sock_reset(hc_sock_t *s);
358 
359 /******************************************************************************
360  * Command-specific structures and functions
361  ******************************************************************************/
362 
363 /*
364  * The following definitions are organized by sections each dealing with a
365  * specific object being manipulated. All follow a similar structure.
366  *
367  * TYPE DEFINITIONS AND ALIASES
368  *
369  * We redefine command struct:
370  * - for uniformization
371  * - to use enum instead of type specifiers more appropriate for packet format
372  * - to use more flexible types such as for manipulating IP addresses
373  * - host endianness
374  * - more intuitive field name, ordering, consistency, and hierarchy removal
375  * - to have command types in between add/list/... commands
376  *
377  * COMMAND IMPLEMENTATION
378  *
379  * All commands return information in a common format
380  *
381  * RETURN DATA FIXME
382  *
383  * \param [out] pdata - Pointer to the structure storing the results of the call
384  * (NULL if no data has been received). If the pointer is NULL, no result will
385  * be stored and only the error code will be exposed to the caller. It is
386  * expected that the caller frees this structure using hc_data_free() after
387  * usage.
388  * \see hc_data_free.
389  *
390  * PARSING
391  *
392  * While this is not made mandatory by the library, the returned data can be
393  * converted to the library's own data structures as described before.
394  *
395  * ITERATORS
396  *
397  * Macros are defined to facilitate iteration on the returned data structures.
398  */
399 
400 #ifndef SPACES
401 #define SPACES(x) x
402 #endif
403 #ifndef SPACE
404 #define SPACE SPACES(1)
405 #endif
406 #ifndef NULLTERM
407 #define NULLTERM 1
408 #endif
409 
410 #define INTERFACE_LEN 16
411 
412 #define MAXSZ_HC_NAME_ SYMBOLIC_NAME_LEN
413 #define MAXSZ_HC_NAME MAXSZ_HC_NAME_ + NULLTERM
414 
415 #define MAXSZ_HC_ID_ 10 /* Number of digits for MAX_INT */
416 #define MAXSZ_HC_ID MAXSZ_HC_ID_ + NULLTERM
417 
418 #define foreach_type(TYPE, VAR, data) \
419  for (TYPE *VAR = (TYPE *)data->buffer; \
420  VAR < (TYPE *)(data->buffer + data->size * data->out_element_size); \
421  VAR++)
422 
427 #define foreach_connection_type \
428  _(UNDEFINED) \
429  _(TCP) \
430  _(UDP) \
431  _(HICN) \
432  _(N)
433 
434 typedef enum {
435 #define _(x) CONNECTION_TYPE_##x,
437 #undef _
438 } hc_connection_type_t;
439 
440 #define MAXSZ_HC_CONNECTION_TYPE_ 9
441 #define MAXSZ_HC_CONNECTION_TYPE MAXSZ_HC_CONNECTION_TYPE_ + NULLTERM + HOTFIXMARGIN
442 
443 extern const char *connection_type_str[];
444 
445 hc_connection_type_t connection_type_from_str(const char *str);
446 
447 /* Same order as connection_state_t in hicn/core/connectionState.h */
448 #define foreach_connection_state \
449  _(UNDEFINED) \
450  _(DOWN) \
451  _(UP) \
452  _(N)
453 
454 typedef enum {
455 #define _(x) HC_CONNECTION_STATE_##x,
456  foreach_connection_state
457 #undef _
458 } hc_connection_state_t;
459 
460 #define MAXSZ_HC_CONNECTION_STATE_ 9
461 #define MAXSZ_HC_CONNECTION_STATE MAXSZ_HC_CONNECTION_STATE_ + NULLTERM
462 
463 extern const char *connection_state_str[];
464 
465 typedef int (*HC_PARSE)(const u8 *, u8 *);
466 
467 /*----------------------------------------------------------------------------*
468  * Listeners
469  *----------------------------------------------------------------------------*/
470 
471 // FIXME the listener should not require any port for hICN...
472 typedef struct {
473  char name[SYMBOLIC_NAME_LEN]; /* K.w */ // XXX clarify what used for
474  char interface_name[INTERFACE_LEN]; /* Kr. */
475  u32 id;
476  hc_connection_type_t type; /* .rw */
477  int family; /* .rw */
478  ip_address_t local_addr; /* .rw */
479  u16 local_port; /* .rw */
480 } hc_listener_t;
481 
482 int hc_listener_create(hc_sock_t *s, hc_listener_t *listener);
483 /* listener_found might eventually be allocated, and needs to be freed */
484 int hc_listener_get(hc_sock_t *s, hc_listener_t *listener,
485  hc_listener_t **listener_found);
486 int hc_listener_delete(hc_sock_t *s, hc_listener_t *listener);
487 int hc_listener_list(hc_sock_t *s, hc_data_t **pdata);
488 
489 int hc_listener_validate(const hc_listener_t *listener);
490 int hc_listener_cmp(const hc_listener_t *l1, const hc_listener_t *l2);
491 int hc_listener_parse(void *in, hc_listener_t *listener);
492 
493 #define foreach_listener(VAR, data) foreach_type(hc_listener_t, VAR, data)
494 
495 #define MAXSZ_HC_LISTENER_ \
496  INTERFACE_LEN + SPACE + MAXSZ_URL_ + SPACE + MAXSZ_HC_CONNECTION_TYPE_
497 #define MAXSZ_HC_LISTENER MAXSZ_HC_LISTENER_ + NULLTERM
498 
499 GENERATE_FIND_HEADER(listener);
500 
501 int hc_listener_snprintf(char *s, size_t size, hc_listener_t *listener);
502 
503 /*----------------------------------------------------------------------------*
504  * Connections
505  *----------------------------------------------------------------------------*/
506 
507 /*
508  * NOTE :
509  * - interface_name is mainly used to derive listeners from connections, but is
510  * not itself used to create connections.
511  */
512 typedef struct {
513  u32 id; /* Kr. */
514  char name[SYMBOLIC_NAME_LEN]; /* K.w */
515  char interface_name[INTERFACE_LEN]; /* Kr. */
516  hc_connection_type_t type; /* .rw */
517  int family; /* .rw */
518  ip_address_t local_addr; /* .rw */
519  u16 local_port; /* .rw */
520  ip_address_t remote_addr; /* .rw */
521  u16 remote_port; /* .rw */
522  hc_connection_state_t admin_state; /* .rw */
523 #ifdef WITH_POLICY
524  uint32_t priority; /* .rw */
525  policy_tags_t tags; /* .rw */
526 #endif /* WITH_POLICY */
527  hc_connection_state_t state; /* .r. */
529 
530 int hc_connection_create(hc_sock_t *s, hc_connection_t *connection);
531 /* connection_found will be allocated, and must be freed */
532 int hc_connection_get(hc_sock_t *s, hc_connection_t *connection,
533  hc_connection_t **connection_found);
534 int hc_connection_update_by_id(hc_sock_t *s, int hc_connection_id,
535  hc_connection_t *connection);
536 int hc_connection_update(hc_sock_t *s, hc_connection_t *connection_current,
537  hc_connection_t *connection_updated);
538 int hc_connection_delete(hc_sock_t *s, hc_connection_t *connection);
539 /*
540 int hc_connection_remove_by_id(hc_sock_t * s, char * name);
541 int hc_connection_remove_by_name(hc_sock_t * s, char * name);
542 */
543 int hc_connection_list(hc_sock_t *s, hc_data_t **pdata);
544 
545 int hc_connection_validate(const hc_connection_t *connection);
546 int hc_connection_cmp(const hc_connection_t *c1, const hc_connection_t *c2);
547 int hc_connection_parse(void *in, hc_connection_t *connection);
548 
549 int hc_connection_set_admin_state(hc_sock_t * s, const char * conn_id_or_name, face_state_t state);
550 #ifdef WITH_POLICY
551 int hc_connection_set_priority(hc_sock_t * s, const char * conn_id_or_name, uint32_t priority);
552 int hc_connection_set_tags(hc_sock_t * s, const char * conn_id_or_name, policy_tags_t tags);
553 #endif /* WITH_POLICY */
554 
555 #define foreach_connection(VAR, data) foreach_type(hc_connection_t, VAR, data)
556 
557 #define MAXSZ_HC_CONNECTION_ \
558  MAXSZ_HC_CONNECTION_STATE_ + INTERFACE_LEN + SPACE + 2 * MAXSZ_URL_ + \
559  MAXSZ_HC_CONNECTION_TYPE_ + SPACES(3)
560 #define MAXSZ_HC_CONNECTION MAXSZ_HC_CONNECTION_ + NULLTERM
561 
562 GENERATE_FIND_HEADER(connection);
563 
564 int hc_connection_snprintf(char *s, size_t size,
565  const hc_connection_t *connection);
566 
567 /*----------------------------------------------------------------------------*
568  * Faces
569  *
570  * A face is an abstraction introduced by the control library to abstract the
571  * forwarder implementation details. It encompasses connections and listeners
572  * and ensures the right dependencies are enforced, eg that we always have a
573  * listener when a connection is created.
574  *
575  *----------------------------------------------------------------------------*/
576 
577 typedef struct {
578  face_id_t id;
579  char name[SYMBOLIC_NAME_LEN];
580  face_t face; // or embed ?
581  // face_id_t parent; /* Pointer from connection to listener */
582 } hc_face_t;
583 
592 int hc_face_create(hc_sock_t *s, hc_face_t *face);
593 int hc_face_get(hc_sock_t *s, hc_face_t *face, hc_face_t **face_found);
594 int hc_face_delete(hc_sock_t *s, hc_face_t *face);
595 int hc_face_list(hc_sock_t *s, hc_data_t **pdata);
596 int hc_face_list_async(hc_sock_t *s); //, hc_data_t ** pdata);
597 
598 int hc_face_set_admin_state(hc_sock_t * s, const char * conn_id_or_name, face_state_t state);
599 #ifdef WITH_POLICY
600 int hc_face_set_priority(hc_sock_t * s, const char * conn_id_or_name, uint32_t priority);
601 int hc_face_set_tags(hc_sock_t * s, const char * conn_id_or_name, policy_tags_t tags);
602 #endif /* WITH_POLICY */
603 
604 #define foreach_face(VAR, data) foreach_type(hc_face_t, VAR, data)
605 
606 #define MAX_FACE_ID 255
607 #define MAXSZ_FACE_ID_ 3
608 #define MAXSZ_FACE_ID MAXSZ_FACE_ID_ + NULLTERM
609 #define MAXSZ_FACE_NAME_ SYMBOLIC_NAME_LEN
610 #define MAXSZ_FACE_NAME MAXSZ_FACE_NAME_ + NULLTERM
611 
612 #define MAXSZ_HC_FACE_ MAXSZ_FACE_ID_ + MAXSZ_FACE_NAME_ + MAXSZ_FACE_ + 5 + HOTFIXMARGIN
613 #define MAXSZ_HC_FACE MAXSZ_HC_FACE_ + NULLTERM
614 
615 int hc_face_snprintf(char *s, size_t size, hc_face_t *face);
616 
617 /*----------------------------------------------------------------------------*
618  * Routes
619  *----------------------------------------------------------------------------*/
620 
621 typedef struct {
622  face_id_t face_id; /* Kr. */
623  int family; /* Krw */
624  ip_address_t remote_addr; /* krw */
625  u8 len; /* krw */
626  u16 cost; /* .rw */
627  hc_face_t face;
628 } hc_route_t;
629 
630 int hc_route_parse(void *in, hc_route_t *route);
631 
632 int hc_route_create(hc_sock_t * s, hc_route_t * route);
633 int hc_route_delete(hc_sock_t * s, hc_route_t * route);
634 int hc_route_list(hc_sock_t * s, hc_data_t ** pdata);
635 int hc_route_list_async(hc_sock_t * s);
636 
637 #define foreach_route(VAR, data) foreach_type(hc_route_t, VAR, data)
638 
639 #define MAX_COST 65535
640 #define MAXSZ_COST 5
641 #define MAX_LEN 255
642 #define MAXSZ_LEN 3
643 
644 #define MAXSZ_HC_ROUTE_ \
645  MAXSZ_FACE_ID + 1 + MAXSZ_COST + 1 + MAXSZ_IP_ADDRESS + 1 + MAXSZ_LEN
646 #define MAXSZ_HC_ROUTE MAXSZ_HC_ROUTE_ + NULLTERM
647 
648 int hc_route_snprintf(char *s, size_t size, hc_route_t *route);
649 
650 /*----------------------------------------------------------------------------*
651  * Punting
652  *----------------------------------------------------------------------------*/
653 
654 typedef struct {
655  face_id_t face_id; /* Kr. */ // XXX listener id, could be NULL for all ?
656  int family; /* Krw */
657  ip_address_t prefix; /* krw */
658  u8 prefix_len; /* krw */
659 } hc_punting_t;
660 
661 int hc_punting_create(hc_sock_t *s, hc_punting_t *punting);
662 int hc_punting_get(hc_sock_t *s, hc_punting_t *punting,
663  hc_punting_t **punting_found);
664 int hc_punting_delete(hc_sock_t *s, hc_punting_t *punting);
665 int hc_punting_list(hc_sock_t *s, hc_data_t **pdata);
666 
667 int hc_punting_validate(const hc_punting_t *punting);
668 int hc_punting_cmp(const hc_punting_t *c1, const hc_punting_t *c2);
669 int hc_punting_parse(void *in, hc_punting_t *punting);
670 
671 #define foreach_punting(VAR, data) foreach_type(hc_punting_t, VAR, data)
672 
673 #define MAXSZ_HC_PUNTING_ 0
674 #define MAXSZ_HC_PUNTING MAXSZ_HC_PUNTING_ + NULLTERM
675 
676 GENERATE_FIND_HEADER(punting);
677 
678 int hc_punting_snprintf(char *s, size_t size, hc_punting_t *punting);
679 
680 /*----------------------------------------------------------------------------*
681  * Cache
682  *----------------------------------------------------------------------------*/
683 
684 int hc_cache_set_store(hc_sock_t *s, int enabled);
685 int hc_cache_set_serve(hc_sock_t *s, int enabled);
686 
687 /*----------------------------------------------------------------------------*
688  * Strategy
689  *----------------------------------------------------------------------------*/
690 
691 #define MAXSZ_STRATEGY_NAME 255
692 
693 typedef struct {
694  char name[MAXSZ_STRATEGY_NAME];
695 } hc_strategy_t;
696 
697 int hc_strategy_list(hc_sock_t *s, hc_data_t **data);
698 
699 #define foreach_strategy(VAR, data) foreach_type(hc_strategy_t, VAR, data)
700 
701 #define MAXSZ_HC_STRATEGY_ MAXSZ_STRATEGY_NAME
702 #define MAXSZ_HC_STRATEGY MAXSZ_HC_STRATEGY_ + NULLTERM
703 
704 int hc_strategy_snprintf(char *s, size_t size, hc_strategy_t *strategy);
705 
706 // per prefix
707 int hc_strategy_set(hc_sock_t *s /* XXX */);
708 
709 /*----------------------------------------------------------------------------*
710  * WLDR
711  *----------------------------------------------------------------------------*/
712 
713 // per connection
714 int hc_wldr_set(hc_sock_t *s /* XXX */);
715 
716 /*----------------------------------------------------------------------------*
717  * MAP-Me
718  *----------------------------------------------------------------------------*/
719 
720 int hc_mapme_set(hc_sock_t *s, int enabled);
721 int hc_mapme_set_discovery(hc_sock_t *s, int enabled);
722 int hc_mapme_set_timescale(hc_sock_t *s, double timescale);
723 int hc_mapme_set_retx(hc_sock_t *s, double timescale);
724 
725 /*----------------------------------------------------------------------------*
726  * Policies
727  *----------------------------------------------------------------------------*/
728 
729 #ifdef WITH_POLICY
730 
731 typedef struct {
732  int family; /* Krw */
733  ip_address_t remote_addr; /* krw */
734  u8 len; /* krw */
735  hicn_policy_t policy; /* .rw */
736 } hc_policy_t;
737 
738 int hc_policy_parse(void *in, hc_policy_t *policy);
739 
740 int hc_policy_create(hc_sock_t *s, hc_policy_t *policy);
741 int hc_policy_delete(hc_sock_t *s, hc_policy_t *policy);
742 int hc_policy_list(hc_sock_t *s, hc_data_t **pdata);
743 
744 #define foreach_policy(VAR, data) foreach_type(hc_policy_t, VAR, data)
745 
746 /* TODO */
747 #define MAXSZ_HC_POLICY_ 0
748 #define MAXSZ_HC_POLICY MAXSZ_HC_POLICY_ + NULLTERM
749 
750 int hc_policy_snprintf(char *s, size_t size, hc_policy_t *policy);
751 
752 #endif /* WITH_POLICY */
753 
754 #endif /* HICNTRL_API */
hc_data_s
Holds the results of an hICN control request.
Definition: api.h:132
hc_strategy_t
Definition: api.h:693
face_t
Definition: face.h:153
hc_data_t
struct hc_data_s hc_data_t
Holds the results of an hICN control request.
hc_face_t
Definition: api.h:577
hc_sock_callback
int hc_sock_callback(hc_sock_t *s, hc_data_t **data)
Callback used in async mode when data is available on the socket.
hc_sock_get_next_seq
int hc_sock_get_next_seq(hc_sock_t *s)
Returns the next available sequence number to use for requests to the API.
hc_data_reset
int hc_data_reset(hc_data_t *data)
Reset the data structure holding control data.
ip_address_t
Definition: ip_address.h:68
hc_data_free
void hc_data_free(hc_data_t *data)
hc_sock_recv
int hc_sock_recv(hc_sock_t *s)
Helper for reading socket contents.
hc_data_create
hc_data_t * hc_data_create(size_t in_element_size, size_t out_element_size, data_callback_t complete_cb)
hc_face_create
int hc_face_create(hc_sock_t *s, hc_face_t *face)
Create a face.
hc_sock_set_nonblocking
int hc_sock_set_nonblocking(hc_sock_t *s)
Sets the socket as non-blocking.
hc_data_set_callback
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.
hc_sock_send
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)
GENERATE_FIND_HEADER
#define GENERATE_FIND_HEADER(TYPE)
Find en element in the data structure.
Definition: api.h:217
hc_data_set_complete
int hc_data_set_complete(hc_data_t *data)
Mark the data structure as complete.
hc_connection_t
Definition: api.h:512
hicn_policy_t
Definition: policy.h:216
hc_sock_create
hc_sock_t * hc_sock_create(void)
Create an hICN control socket using the default connection type.
hc_punting_t
Definition: api.h:654
hc_sock_get_available
int hc_sock_get_available(hc_sock_t *s, u8 **buffer, size_t *size)
Return the offset and size of available buffer space.
face.h
Face abstraction.
hc_sock_reset
int hc_sock_reset(hc_sock_t *s)
Reset the state of the sock (eg. to handle a reconnecton)
hc_route_t
Definition: api.h:621
foreach_connection_type
#define foreach_connection_type
Definition: api.h:427
hc_data_push_many
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.
hc_sock_create_forwarder
hc_sock_t * hc_sock_create_forwarder(forwarder_t forwarder)
Create an hICN control socket using the provided forwarder.
hc_data_s::command_id
u8 command_id
Definition: api.h:138
hc_sock_free
void hc_sock_free(hc_sock_t *s)
Frees an hICN control socket.
hc_sock_create_url
hc_sock_t * hc_sock_create_url(const char *url)
Create an hICN control socket using the specified URL.
hc_sock_get_fd
int hc_sock_get_fd(hc_sock_t *s)
Return the file descriptor associated to the hICN contorl sock.
hc_sock_s
Definition: api_private.h:89
hc_msg_t
struct hc_msg_s hc_msg_t
hICN control message header
Definition: api.h:120
hc_sock_connect
int hc_sock_connect(hc_sock_t *s)
Connect the socket.
hc_listener_t
Definition: api.h:472
hc_data_push
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.
hc_sock_process
int hc_sock_process(hc_sock_t *s, hc_data_t **data)
Processing data received by socket.