mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 14:33:52 +01:00
pkg ccn-lite: update documentation and prototype
This commit is contained in:
parent
bf65a08d63
commit
813a6fa86c
@ -131,6 +131,13 @@ extern "C" {
|
||||
*/
|
||||
#define CCNL_QUEUE_SIZE (8)
|
||||
|
||||
typedef struct {
|
||||
struct ccnl_prefix_s *prefix;
|
||||
unsigned char *buf;
|
||||
size_t buflen;
|
||||
} ccnl_interest_t;
|
||||
|
||||
|
||||
/**
|
||||
* Maximum string length for prefix representation
|
||||
*/
|
||||
@ -196,17 +203,15 @@ int ccnl_open_netif(kernel_pid_t if_pid, gnrc_nettype_t netreg_type);
|
||||
/**
|
||||
* @brief Sends out an Interest
|
||||
*
|
||||
* @param[in] suite CCN packet format
|
||||
* @param[in] name The name that is requested
|
||||
* @param[in] chunknum Number of the requested content chunk
|
||||
* @param[in] prefix The name that is requested
|
||||
* @param[out] buf Buffer to write the content chunk to
|
||||
* @param[in] buf_len Size of @p buf
|
||||
*
|
||||
* @return 0 on successfully sent Interest
|
||||
* @return -1 if Interested couldn't be sent
|
||||
* @return pointer to the successfully sent Interest
|
||||
* @return NULL if Interest couldn't be sent
|
||||
*/
|
||||
int ccnl_send_interest(int suite, char *name, unsigned int *chunknum,
|
||||
unsigned char *buf, size_t buf_len);
|
||||
struct ccnl_interest_s *ccnl_send_interest(struct ccnl_prefix_s *prefix,
|
||||
unsigned char *buf, size_t buf_len);
|
||||
|
||||
/**
|
||||
* @brief Wait for incoming content chunk
|
||||
|
||||
@ -223,12 +223,14 @@ int _ccnl_interest(int argc, char **argv)
|
||||
_ne.pid = sched_active_pid;
|
||||
gnrc_netreg_register(GNRC_NETTYPE_CCN_CHUNK, &_ne);
|
||||
|
||||
ccnl_send_interest(CCNL_SUITE_NDNTLV, argv[1], NULL, _int_buf, BUF_SIZE);
|
||||
struct ccnl_prefix_s *prefix = ccnl_URItoPrefix(argv[1], CCNL_SUITE_NDNTLV, NULL, 0);
|
||||
ccnl_send_interest(prefix, _int_buf, BUF_SIZE);
|
||||
if (ccnl_wait_for_chunk(_cont_buf, BUF_SIZE, 0) > 0) {
|
||||
gnrc_netreg_unregister(GNRC_NETTYPE_CCN_CHUNK, &_ne);
|
||||
printf("Content received: %s\n", _cont_buf);
|
||||
return 0;
|
||||
}
|
||||
ccnl_free(prefix);
|
||||
gnrc_netreg_unregister(GNRC_NETTYPE_CCN_CHUNK, &_ne);
|
||||
}
|
||||
printf("Timeout! No content received in response to the Interest for %s.\n", argv[1]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user