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
86c319ae
Commit
86c319ae
authored
6 years ago
by
Peter Kietzmann
Browse files
Options
Downloads
Patches
Plain Diff
pkg/ccn-lite:enable CS dump and rename shell command
parent
d7bf2c11
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/ccn-lite-relay/README.md
+7
-6
7 additions, 6 deletions
examples/ccn-lite-relay/README.md
sys/shell/commands/sc_ccnl.c
+21
-21
21 additions, 21 deletions
sys/shell/commands/sc_ccnl.c
sys/shell/commands/shell_commands.c
+1
-1
1 addition, 1 deletion
sys/shell/commands/shell_commands.c
with
29 additions
and
28 deletions
examples/ccn-lite-relay/README.md
+
7
−
6
View file @
86c319ae
...
...
@@ -15,12 +15,13 @@ RIOT provides three shell to interact with the CCN-Lite stack:
If the second parameter is omitted, the Interest will be
broadcasted. You may call it like this:
`ccnl_int /riot/peter/schmerzl b6:e5:94:26:ab:da`
*
`ccnl_cont`
- generates and populates content. The command expects one
mandatory and one optional parameter. The first parameter
specifies the name of the content to be created, the second
parameter specifies the content itself. The second parameter
may include spaces, e.g. you can call:
`ccnl_cont /riot/peter/schmerzl Hello World! Hello RIOT!`
*
`ccnl_cs`
- dumps CS or generates and populates content. If the command is
called without parameters, it will print all content items in
the cache. Otherwise, the command expects two parameters. The
first parameter specifies the name of the content to be created,
the second parameter specifies the content itself. The second
parameter may include spaces, e.g. you can call:
`ccnl_cont /riot/peter/schmerzl Hello World! Hello RIOT!`
*
`ccnl_fib`
- modifies the FIB or shows its current state. If the command is
called without parameters, it will print the current state of
the FIB. It can also be called with the action parameters
`add`
...
...
This diff is collapsed.
Click to expand it.
sys/shell/commands/sc_ccnl.c
+
21
−
21
View file @
86c319ae
...
...
@@ -30,7 +30,6 @@
static
unsigned
char
_int_buf
[
BUF_SIZE
];
static
const
char
*
_default_content
=
"Start the RIOT!"
;
static
unsigned
char
_out
[
CCNL_MAX_PACKET_SIZE
];
/* usage for open command */
...
...
@@ -75,44 +74,45 @@ int _ccnl_open(int argc, char **argv)
static
void
_content_usage
(
char
*
argv
)
{
printf
(
"usage: %s
<
URI
>
[content]
\n
"
"
%% %s /riot/peter/schmerzl (default content)
\n
"
printf
(
"usage: %s
[
URI
]
[content]
\n
"
"
prints the CS if called without parameters:
\n
"
"%% %s /riot/peter/schmerzl RIOT
\n
"
,
argv
,
argv
,
argv
);
argv
,
argv
);
}
int
_ccnl_content
(
int
argc
,
char
**
argv
)
{
if
(
argc
<
2
)
{
ccnl_cs_dump
(
&
ccnl_relay
);
return
0
;
}
if
(
argc
==
2
)
{
_content_usage
(
argv
[
0
]);
return
-
1
;
}
int
arg_len
;
char
*
body
=
(
char
*
)
_default_content
;
char
buf
[
BUF_SIZE
+
1
];
/* add one extra space to fit trailing '\0' */
if
(
argc
>
2
)
{
unsigned
pos
=
0
;
for
(
int
i
=
2
;
(
i
<
argc
)
&&
(
pos
<
BUF_SIZE
);
++
i
)
{
arg_len
=
strlen
(
argv
[
i
]);
if
((
pos
+
arg_len
)
>
BUF_SIZE
)
{
arg_len
=
BUF_SIZE
-
pos
;
}
strncpy
(
&
buf
[
pos
],
argv
[
i
],
arg_len
);
pos
+=
arg_len
;
/* increment pos _after_ adding ' ' */
buf
[
pos
++
]
=
' '
;
unsigned
pos
=
0
;
for
(
int
i
=
2
;
(
i
<
argc
)
&&
(
pos
<
BUF_SIZE
);
++
i
)
{
arg_len
=
strlen
(
argv
[
i
]);
if
((
pos
+
arg_len
)
>
BUF_SIZE
)
{
arg_len
=
BUF_SIZE
-
pos
;
}
/* decrement pos _before_ to overwrite last ' ' with '\0' */
buf
[
--
pos
]
=
'\0'
;
body
=
buf
;
strncpy
(
&
buf
[
pos
],
argv
[
i
],
arg_len
);
pos
+=
arg_len
;
/* increment pos _after_ adding ' ' */
buf
[
pos
++
]
=
' '
;
}
arg_len
=
strlen
(
body
);
/* decrement pos _before_ to overwrite last ' ' with '\0' */
buf
[
--
pos
]
=
'\0'
;
arg_len
=
strlen
(
buf
);
struct
ccnl_prefix_s
*
prefix
=
ccnl_URItoPrefix
(
argv
[
1
],
CCNL_SUITE_NDNTLV
,
NULL
,
NULL
);
int
offs
=
CCNL_MAX_PACKET_SIZE
;
arg_len
=
ccnl_ndntlv_prependContent
(
prefix
,
(
unsigned
char
*
)
b
ody
,
arg_len
,
NULL
,
NULL
,
&
offs
,
_out
);
arg_len
=
ccnl_ndntlv_prependContent
(
prefix
,
(
unsigned
char
*
)
b
uf
,
arg_len
,
NULL
,
NULL
,
&
offs
,
_out
);
ccnl_prefix_free
(
prefix
);
...
...
This diff is collapsed.
Click to expand it.
sys/shell/commands/shell_commands.c
+
1
−
1
View file @
86c319ae
...
...
@@ -213,7 +213,7 @@ const shell_command_t _shell_command_list[] = {
#ifdef MODULE_CCN_LITE_UTILS
{
"ccnl_open"
,
"opens an interface or socket"
,
_ccnl_open
},
{
"ccnl_int"
,
"sends an interest"
,
_ccnl_interest
},
{
"ccnl_c
ont
"
,
"create content and populate
d
it"
,
_ccnl_content
},
{
"ccnl_c
s
"
,
"
shows CS or
create
s
content and populate
s
it"
,
_ccnl_content
},
{
"ccnl_fib"
,
"shows or modifies the CCN-Lite FIB"
,
_ccnl_fib
},
#endif
#ifdef MODULE_SNTP
...
...
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