示例#1
0
static void riot_ccnl_appserver_register(void)
{
    char faceid[10];
    snprintf(faceid, sizeof(faceid), "%d", thread_getpid());
    char *type = "newMSGface";

    unsigned char *mgnt_pkg = malloc(256);
    if (!mgnt_pkg) {
        puts("riot_ccnl_appserver_register: malloc failed");
        return;
    }
    int content_len = ccnl_riot_client_publish(relay_pid, prefix, faceid, type, mgnt_pkg);
    DEBUG("received %d bytes.\n", content_len);
    DEBUG("appserver received: '%s'\n", mgnt_pkg);

    free(mgnt_pkg);
}
示例#2
0
static void riot_ccn_register_prefix(int argc, char **argv)
{
    if (argc < 4) {
        puts("enter: prefix </path/to/abc> <type> <faceid>");
        return;
    }

    strncpy(small_buf, argv[1], 100);
    DEBUG("prefix='%s'\n", small_buf);

    char *type = argv[2];
    char *faceid = argv[3]; // 0=trans;1=msg

    int content_len = ccnl_riot_client_publish(relay_pid, small_buf, faceid, type, big_buf);

    DEBUG("shell received: '%s'\n", big_buf);
    DEBUG("received %d bytes.\n", content_len);
    puts("done");
}