Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
587a435a
Commit
587a435a
authored
9 years ago
by
Oleg Hahm
Browse files
Options
Downloads
Patches
Plain Diff
pkg ccn-lite: adapt to updated CCN-Lite version
parent
8ef719b4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pkg/ccn-lite/ccn-lite-riot.h
+40
-7
40 additions, 7 deletions
pkg/ccn-lite/ccn-lite-riot.h
sys/shell/commands/sc_ccnl.c
+3
-3
3 additions, 3 deletions
sys/shell/commands/sc_ccnl.c
with
43 additions
and
10 deletions
pkg/ccn-lite/ccn-lite-riot.h
+
40
−
7
View file @
587a435a
...
...
@@ -105,6 +105,22 @@ extern "C" {
* @}
*/
/**
* @brief Some macro definitions
* @{
*/
#define free_2ptr_list(a,b) ccnl_free(a), ccnl_free(b)
#define free_3ptr_list(a,b,c) ccnl_free(a), ccnl_free(b), ccnl_free(c)
#define free_4ptr_list(a,b,c,d) ccnl_free(a), ccnl_free(b), ccnl_free(c), ccnl_free(d);
#define free_5ptr_list(a,b,c,d,e) ccnl_free(a), ccnl_free(b), ccnl_free(c), ccnl_free(d), ccnl_free(e);
/**
* Frees all memory directly and indirectly allocated for prefix information
*/
#define free_prefix(p) do{ if(p) \
free_5ptr_list(p->bytes,p->comp,p->complen,p->chunknum,p); } while(0)
/**
* Constant string
*/
...
...
@@ -123,7 +139,7 @@ extern "C" {
/**
* Struct holding CCN-Lite's central relay information
*/
extern
struct
ccnl_relay_s
theR
elay
;
extern
struct
ccnl_relay_s
ccnl_r
elay
;
/**
* @brief Start the main CCN-Lite event-loop
...
...
@@ -149,8 +165,6 @@ int ccnl_open_netif(kernel_pid_t if_pid, gnrc_nettype_t netreg_type);
*
* @param[in] suite CCN packet format
* @param[in] name The name that is requested
* @param[in] addr The relay's address to send to
* @param[in] addr_len Length of @p addr
* @param[in] chunknum Number of the requested content chunk
* @param[out] buf Buffer to write the content chunk to
* @param[in] buf_len Size of @p buf
...
...
@@ -158,9 +172,8 @@ int ccnl_open_netif(kernel_pid_t if_pid, gnrc_nettype_t netreg_type);
* @return 0 on successfully sent Interest
* @return -1 if Interested couldn't be sent
*/
int
ccnl_send_interest
(
int
suite
,
char
*
name
,
uint8_t
*
addr
,
size_t
addr_len
,
unsigned
int
*
chunknum
,
unsigned
char
*
buf
,
size_t
buf_len
);
int
ccnl_send_interest
(
int
suite
,
char
*
name
,
unsigned
int
*
chunknum
,
unsigned
char
*
buf
,
size_t
buf_len
);
/**
* @brief Waits for incoming content chunk
...
...
@@ -168,7 +181,27 @@ int ccnl_send_interest(int suite, char *name, uint8_t *addr, size_t addr_len,
* @return 0 if a content was received
* @return -ETIMEDOUT if no chunk was received until timeout
*/
int
ccnl_wait_for_chunk
(
void
*
buf
,
size_t
buf_len
);
int
ccnl_wait_for_chunk
(
void
*
buf
,
size_t
buf_len
,
uint64_t
timeout
);
/**
* @brief Add entry to the CCN-Lite FIB
*
* @par[in] relay Local relay struct
* @par[in] pfx Prefix of the FIB entry
* @par[in] face Face for the FIB entry
*
* @return 0 on success
* @return -1 on error
*/
int
ccnl_fib_add_entry
(
struct
ccnl_relay_s
*
relay
,
struct
ccnl_prefix_s
*
pfx
,
struct
ccnl_face_s
*
face
);
/**
* @brief Prints the current CCN-Lite FIB
*
* @par[in] relay Local relay struct
*/
void
ccnl_fib_show
(
struct
ccnl_relay_s
*
relay
);
#ifdef __cplusplus
}
...
...
This diff is collapsed.
Click to expand it.
sys/shell/commands/sc_ccnl.c
+
3
−
3
View file @
587a435a
...
...
@@ -138,8 +138,8 @@ int _ccnl_content(int argc, char **argv)
struct
ccnl_content_s
*
c
=
0
;
struct
ccnl_pkt_s
*
pk
=
ccnl_ndntlv_bytes2pkt
(
typ
,
olddata
,
&
data
,
&
arg_len
);
c
=
ccnl_content_new
(
&
theR
elay
,
&
pk
);
ccnl_content_add2cache
(
&
theR
elay
,
c
);
c
=
ccnl_content_new
(
&
ccnl_r
elay
,
&
pk
);
ccnl_content_add2cache
(
&
ccnl_r
elay
,
c
);
c
->
flags
|=
CCNL_CONTENT_FLAGS_STATIC
;
return
0
;
...
...
@@ -171,7 +171,7 @@ int _ccnl_interest(int argc, char **argv)
memset
(
_cont_buf
,
'\0'
,
BUF_SIZE
);
for
(
int
cnt
=
0
;
cnt
<
CCNL_INTEREST_RETRIES
;
cnt
++
)
{
ccnl_send_interest
(
CCNL_SUITE_NDNTLV
,
argv
[
1
],
relay_addr
,
addr_len
,
NULL
,
_int_buf
,
BUF_SIZE
);
if
(
ccnl_wait_for_chunk
(
_cont_buf
,
BUF_SIZE
)
>
0
)
{
if
(
ccnl_wait_for_chunk
(
_cont_buf
,
BUF_SIZE
,
0
)
>
0
)
{
printf
(
"Content received: %s
\n
"
,
_cont_buf
);
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment