
From carlosnevesabrantes@gmail.com  Wed Dec  5 07:00:13 2012
Return-Path: <carlosnevesabrantes@gmail.com>
X-Original-To: dtn-security@ietfa.amsl.com
Delivered-To: dtn-security@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 65D3221F8C13; Wed,  5 Dec 2012 07:00:13 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 1.422
X-Spam-Level: *
X-Spam-Status: No, score=1.422 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, HTML_MESSAGE=0.001, J_CHICKENPOX_43=0.6, J_CHICKENPOX_47=0.6, J_CHICKENPOX_57=0.6, J_CHICKENPOX_64=0.6, J_CHICKENPOX_66=0.6, J_CHICKENPOX_75=0.6, RCVD_IN_DNSWL_LOW=-1, SARE_ADULT2=1.42]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uppkbIyTxu8E; Wed,  5 Dec 2012 07:00:11 -0800 (PST)
Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by ietfa.amsl.com (Postfix) with ESMTP id A281821F8C84; Wed,  5 Dec 2012 07:00:10 -0800 (PST)
Received: by mail-wi0-f180.google.com with SMTP id hj13so1774232wib.1 for <multiple recipients>; Wed, 05 Dec 2012 07:00:09 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=oJ6RKbgEdY9592mZNU5MU7jVIlWRdMIKrnSCnftiPVE=; b=Pz0PaTc4kDNivVqkf9AkYOD7rUV+NWFe6IGplYYa6p2L4O/NRwt0Ik0QbUu5a3n2ML ewiMhYxD1NjrSccz33MKnFGAE+i1wMIndDqzqmKdrD9CNyX7Dj4BrEuL3h6K5VPgAjjH OfgM+KDY42qkXYA1a9QYsGlPzoHxPS29JPKjMx5fBGW5n78dICC0ORjiR1t0nddTgRXR fB+sHWiIGfvGihEVVAPz2ITklVkVpkEhE+G1kB5kYK45Ry0Kb7xG1AWLFoDHQFT3OCzN ivdmtTly+FHXCqnp8FivKYp58jlCKhNqEhYGwPxLUk3+AdPuD4/vIvYXElda6CkUfL9D 16fA==
MIME-Version: 1.0
Received: by 10.216.209.130 with SMTP id s2mr6985394weo.86.1354719609709; Wed, 05 Dec 2012 07:00:09 -0800 (PST)
Received: by 10.217.46.195 with HTTP; Wed, 5 Dec 2012 07:00:09 -0800 (PST)
In-Reply-To: <CAJNAC6_MConxB2uDprG1CW765rKZ9v=kEHXGZ_ZOKp3QPMM9hw@mail.gmail.com>
References: <CAJNAC6_MConxB2uDprG1CW765rKZ9v=kEHXGZ_ZOKp3QPMM9hw@mail.gmail.com>
Date: Wed, 5 Dec 2012 10:00:09 -0500
Message-ID: <CAJNAC6-0PdkxyydFYPV+FhvTqgq0cKojSWrRjtKHrLOJiGqmTQ@mail.gmail.com>
From: Carlos Neves <carlosnevesabrantes@gmail.com>
To: dtn-interest@irtf.org, dtn-security@irtf.org, dtn-users@mailman.irtf.org
Content-Type: multipart/alternative; boundary=0016e6d7f0b61b66d704d01c3d20
X-Mailman-Approved-At: Wed, 05 Dec 2012 07:10:04 -0800
Subject: [dtn-security] Fwd: Streaming Video with dtn2 and vlc
X-BeenThere: dtn-security@irtf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "The Delay-Tolerant Networking Research Group \(DTNRG\) - Security." <dtn-security.irtf.org>
List-Unsubscribe: <https://www.irtf.org/mailman/options/dtn-security>, <mailto:dtn-security-request@irtf.org?subject=unsubscribe>
List-Archive: <http://www.irtf.org/mail-archive/web/dtn-security>
List-Post: <mailto:dtn-security@irtf.org>
List-Help: <mailto:dtn-security-request@irtf.org?subject=help>
List-Subscribe: <https://www.irtf.org/mailman/listinfo/dtn-security>, <mailto:dtn-security-request@irtf.org?subject=subscribe>
X-List-Received-Date: Wed, 05 Dec 2012 15:06:37 -0000

--0016e6d7f0b61b66d704d01c3d20
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Streaming Video with dtn2 and vlc
Our team is trying compare dtn2 and Ibr-dtn performance in video streaming
to write a paper about this technologies.
I have troubles to send a stream video in dtn2, because dtnsend does not
work as i wanted for the flag "f" (file).
Changing apps/dtnrecv.c, and do the /configure , make , make install again
, now i can send videos from a computer to another.
You have any solution to do stream of video or sending files without
changing dtnrecv.c original file?
I'm using dtnd version 2.9.0

To receive the stream i'm using:
receiver: dtnrecv dtn://carlos.dtn/r | vlc -
It works for remote communications with other computers.


You have a copy above with the modifications we have made.
dtnrecv.c
/*
 *    Copyright 2004-2006 Intel Corporation
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

#ifdef HAVE_CONFIG_H
#  include <dtn-config.h>
#endif

#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <strings.h>
#include <string.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "dtn_api.h"

#define BUFSIZE 16
#define BLOCKSIZE 8192
#define COUNTER_MAX_DIGITS 9

// Find the maximum commandline length
#ifdef __FreeBSD__
/* Needed for PATH_MAX, Linux doesn't need it */
#include <sys/syslimits.h>
#endif

#ifndef PATH_MAX
/* A conservative fallback */
#define PATH_MAX 1024
#endif

const char *progname;

// Daemon connection
int api_IP_set =3D 0;
char * api_IP =3D "127.0.0.1";
short api_port =3D 5010;

int   verbose           =3D 0;        // verbose output
int   doAppAcks         =3D 0;            // Application ack of received
bundles
int   quiet             =3D 0;        // quiet output
char* endpoint        =3D NULL;     // endpoint for registration
dtn_reg_id_t regid    =3D DTN_REGID_NONE;// registration id
int   expiration    =3D 30;         // registration expiration time
int   count             =3D 0;            // exit after count bundles recei=
ved
int   failure_action    =3D DTN_REG_DEFER;// registration delivery failure
action
char* failure_script    =3D "";         // script to exec
int   replay_action    =3D DTN_REPLAY_NEW;// registration delivery replay
semantics
int   register_only    =3D 0;        // register and quit
int   change        =3D 0;        // change existing registration
int   unregister    =3D 0;        // remove existing registration
int   recv_timeout    =3D -1;        // timeout to dtn_recv call
int   no_find_reg    =3D 0;        // omit call to dtn_find_registration
char filename[PATH_MAX];        // Destination filename for file xfers
dtn_bundle_payload_location_t bundletype =3D DTN_PAYLOAD_MEM;

void
usage()
{
    fprintf(stderr, "usage: %s [opts] <endpoint> \n", progname);
    fprintf(stderr, "options:\n");
    fprintf(stderr, " -A daemon api IP address\n");
    fprintf(stderr, " -B daemon api IP port\n");
    fprintf(stderr, " -a Application acknowledgement of received bundles
(to daemon)\n");
    fprintf(stderr, " -v verbose\n");
    fprintf(stderr, " -q quiet\n");
    fprintf(stderr, " -h help\n");
    fprintf(stderr, " -d <eid|demux_string> endpoint id\n");
    fprintf(stderr, " -r <regid> use existing registration regid\n");
    fprintf(stderr, " -n <count> exit after count bundles received\n");
    fprintf(stderr, " -e <time> registration expiration time in seconds "
            "(default: %d)\n", expiration);
    fprintf(stderr, " -f <defer|drop|exec> failure action\n");
    fprintf(stderr, " -R <new|none|all> replay action\n");
    fprintf(stderr, " -F <script> failure script for exec action\n");
    fprintf(stderr, " -x call dtn_register and immediately exit\n");
    fprintf(stderr, " -c call dtn_change_registration and immediately
exit\n");
    fprintf(stderr, " -u call dtn_unregister and immediately exit\n");
    fprintf(stderr, " -N don't try to find an existing registration\n");
    fprintf(stderr, " -t <timeout> timeout value for call to dtn_recv\n");
    fprintf(stderr, " -o <template> Write out transfers to files using this
template (# chars are\n"
            "replaced with a counter). Example: f##.bin goes to f00.bin,
f01.bin, etc...\n");
}

void
parse_options(int argc, char**argv)
{
    int c, done =3D 0;

    progname =3D argv[0];

    memset(filename, 0, sizeof(char) * PATH_MAX);

    while (!done)
    {
        c =3D getopt(argc, argv, "aA:B:vqhHd:r:e:f:R:F:xn:cuNt:o:");
        switch (c)
        {
        case 'a':
            doAppAcks =3D 1;
        case 'A':
            api_IP_set =3D 1;
            api_IP =3D optarg;
            break;
        case 'B':
            api_port =3D atoi(optarg);
            break;
        case 'v':
            verbose =3D 1;
            break;
        case 'q':
            quiet =3D 1;
            break;
        case 'h':
        case 'H':
            usage();
            exit(0);
            return;
        case 'r':
            regid =3D atoi(optarg);
            break;
        case 'e':
            expiration =3D atoi(optarg);
            break;
        case 'f':
            if (!strcasecmp(optarg, "defer")) {
                failure_action =3D DTN_REG_DEFER;

            } else if (!strcasecmp(optarg, "drop")) {
                failure_action =3D DTN_REG_DROP;

            } else if (!strcasecmp(optarg, "exec")) {
                failure_action =3D DTN_REG_EXEC;

            } else {
                fprintf(stderr, "invalid failure action '%s'\n", optarg);
                usage();
                exit(1);
            }
        case 'R':
            if (!strcasecmp(optarg, "new")) {
                replay_action =3D DTN_REPLAY_NEW;

            } else if (!strcasecmp(optarg, "none")) {
                replay_action =3D DTN_REPLAY_NONE;

            } else if (!strcasecmp(optarg, "all")) {
                replay_action =3D DTN_REPLAY_ALL;

            } else {
                fprintf(stderr, "invalid replay action '%s'\n", optarg);
                usage();
                exit(1);
            }
        case 'F':
            failure_script =3D optarg;
            break;
        case 'x':
            register_only =3D 1;
            break;
        case 'n':
            count =3D atoi(optarg);
            break;
        case 'c':
            change =3D 1;
            break;
        case 'u':
            unregister =3D 1;
            break;
        case 'N':
            no_find_reg =3D 1;
            break;
        case 't':
            recv_timeout =3D atoi(optarg);
            break;
        case 'o':
            strncpy(filename, optarg, PATH_MAX);
            break;
        case -1:
            done =3D 1;
            break;
        default:
            // getopt already prints an error message for unknown
            // option characters
            usage();
            exit(1);
        }
    }

    endpoint =3D argv[optind];
    if (!endpoint && (regid =3D=3D DTN_REGID_NONE)) {
        fprintf(stderr, "must specify either an endpoint or a regid\n");
        usage();
        exit(1);
    }

    if ((change || unregister) && (regid =3D=3D DTN_REGID_NONE)) {
        fprintf(stderr, "must specify regid when using -%c option\n",
                change ? 'c' : 'u');
        usage();
        exit(1);
    }

    if (failure_action =3D=3D DTN_REG_EXEC && failure_script =3D=3D NULL) {
        fprintf(stderr, "failure action EXEC must supply script\n");
        usage();
        exit(1);
    }

    // the default is to use memory transfer mode, but if someone specifies
a
    // filename then we need to tell the API to expect a file
    if ( filename[0] !=3D '\0' )
        bundletype =3D DTN_PAYLOAD_FILE;

}


static void
print_data(char* buffer, u_int length)
{
    fwrite(buffer,1,length,stdout);
}

/* -----------------------------------------------------------------------
*/
/* Builds the temporary file based on the template given and an integer
 * counter value
 */
int buildfilename(char* template, char* newfilename, int counter )
{
    char counterasstring[COUNTER_MAX_DIGITS];
    char formatstring[10];
    char* startloc;
    char* endloc;
    int templatelen;

    strcpy(newfilename, template);

    endloc =3D rindex(newfilename, '#');
    /* No template in the filename, just copy it as is */
    if ( endloc =3D=3D NULL )
        return 0;

    /* Search backwards for the start of the template */
    for ( startloc =3D endloc; *startloc =3D=3D '#' && startloc !=3D templa=
te;
          startloc -=3D 1 );

    startloc +=3D 1;

    templatelen =3D endloc - startloc + 1;
    if ( templatelen > COUNTER_MAX_DIGITS )
        templatelen =3D COUNTER_MAX_DIGITS;

    sprintf(formatstring, "%%0%dd", templatelen);
    sprintf(counterasstring, formatstring, counter);

    if ( strlen(counterasstring) > (unsigned int)templatelen )
        fprintf(stderr, "Warning: Filename template not large enough "
                "to support counter value %d\n", counter);

    memcpy(startloc, counterasstring, sizeof(char) * templatelen);

    return 0;
}

/* -----------------------------------------------------------------------
*/
/* File transfers suffer considerably from the inability to safely send
 * metadata on the same channel as the file transfer in DTN.  Perhaps we
 * should work around this?
 */
int
handle_file_transfer(dtn_bundle_spec_t spec, dtn_bundle_payload_t payload,
                     int* total_bytes, int counter)
{
    int tempdes;
    int destdes;
    char block[BLOCKSIZE];
    ssize_t bytesread;
    struct stat fileinfo;
    char currentfile[PATH_MAX];

    // Create the filename by searching for ### characters in the given
    // filename and replacing that with an incrementing counter.
    buildfilename(filename, currentfile, counter);

    // Try to rename the old file to the new name to avoid unnecessary
copying
    if (rename(filename, currentfile) =3D=3D 0) {
        // success!

    } else {
        // Copy the file into place
        tempdes =3D open(payload.filename.filename_val, O_RDONLY);

        if ( tempdes < 0 )
        {
            fprintf(stderr, "While opening the temporary file for reading
'%s': %s\n",
                    payload.filename.filename_val, strerror(errno));
            exit(1);
        }

        destdes =3D creat(currentfile, 0644);

        if ( destdes < 0 )
        {
            fprintf(stderr, "While opening output file for writing '%s':
%s\n",
                    filename, strerror(errno));
            exit(1);
        }

        // Duplicate the file
        while ( (bytesread =3D read(tempdes, block, sizeof(block))) > 0 )
            write(destdes, block, bytesread);

        close(tempdes);
        close(destdes);

        unlink(payload.filename.filename_val);
    }

    if ( stat(currentfile, &fileinfo) =3D=3D -1 )
    {
        fprintf(stderr, "Unable to stat destination file '%s': %s\n",
                currentfile, strerror(errno));
        return 1;
    }

    *total_bytes +=3D fileinfo.st_size;

    return 0;
}

int
main(int argc, char** argv)
{
    int i;
    u_int k;
    int ret;
    int total_bytes =3D 0;
    dtn_handle_t handle;
    dtn_endpoint_id_t local_eid;
    dtn_reg_info_t reginfo;
    dtn_bundle_spec_t spec;
    dtn_bundle_payload_t payload;
    int call_bind;

    // force stdout to always be line buffered, even if output is
    // redirected to a pipe or file
    setvbuf(stdout, (char *)NULL, _IOLBF, 0);

    progname =3D argv[0];

    parse_options(argc, argv);

    int err =3D 0;
    if (api_IP_set) err =3D dtn_open_with_IP(api_IP,api_port,&handle);
    else err =3D dtn_open(&handle);

    if (err !=3D DTN_SUCCESS) {
        fprintf(stderr, "fatal error opening dtn handle: %s\n",
                dtn_strerror(err));
        exit(1);
    }

    // if we're not given a regid, or we're in change mode, we need to
    // build up the reginfo
    memset(&reginfo, 0, sizeof(reginfo));

    if ((regid =3D=3D DTN_REGID_NONE) || change)
    {
        // if the specified eid starts with '/', then build a local
        // eid based on the configuration of our dtn router plus the
        // demux string. otherwise make sure it's a valid one
        if (endpoint[0] =3D=3D '/') {
            dtn_build_local_eid(handle, &local_eid, (char *) endpoint);

        } else {
            if (dtn_parse_eid_string(&local_eid, endpoint)) {
                fprintf(stderr, "invalid destination endpoint '%s'\n",
                        endpoint);
                goto err;
            }
        }

        // create a new registration based on this eid
        dtn_copy_eid(&reginfo.endpoint, &local_eid);
        reginfo.regid             =3D regid;
        reginfo.expiration        =3D expiration;
        reginfo.flags             =3D failure_action;
        reginfo.replay_flags      =3D replay_action;
        reginfo.script.script_val =3D failure_script;
        reginfo.script.script_len =3D strlen(failure_script) + 1;
    }

    if (change) {
        if ((ret =3D dtn_change_registration(handle, regid, &reginfo)) !=3D=
 0) {
            fprintf(stderr, "error changing registration: %d (%s)\n",
                    ret, dtn_strerror(dtn_errno(handle)));
            goto err;
        }
        goto done;
    }

    if (unregister) {
        if (dtn_unregister(handle, regid) !=3D 0) {
            fprintf(stderr, "error in unregister regid %d: %s\n",
                    regid, dtn_strerror(dtn_errno(handle)));
            goto err;
        }

        goto done;
    }

    // try to see if there is an existing registration that matches
    // the given endpoint, in which case we'll use that one.
    if (regid =3D=3D DTN_REGID_NONE && ! no_find_reg) {
        if (dtn_find_registration(handle, &local_eid, &regid) !=3D 0) {
            if (dtn_errno(handle) !=3D DTN_ENOTFOUND) {
                fprintf(stderr, "error in find_registration: %s\n",
                        dtn_strerror(dtn_errno(handle)));
                goto err;
            }
        }
        call_bind =3D 1;
    }

    // if the user didn't give us a registration to use, get a new one
    if (regid =3D=3D DTN_REGID_NONE) {
        if ((ret =3D dtn_register(handle, &reginfo, &regid)) !=3D 0) {
            fprintf(stderr, "error creating registration: %d (%s)\n",
                    ret, dtn_strerror(dtn_errno(handle)));
            goto err;
        }

        call_bind =3D 0;
    } else {
        call_bind =3D 1;
        dtn_parse_eid_string(&local_eid, "dtn://??/?");
    }

    if (register_only) {
        goto done;
    }

    if (call_bind) {
        // bind the current handle to the found registration
        if (dtn_bind(handle, regid) !=3D 0) {
            fprintf(stderr, "error binding to registration: %s\n",
                    dtn_strerror(dtn_errno(handle)));
            goto err;
        }
    }


    for (i =3D 0; (count =3D=3D 0) || (i < count); ++i) {
        memset(&spec, 0, sizeof(spec));
        memset(&payload, 0, sizeof(payload));


        if ((ret =3D dtn_recv(handle, &spec, bundletype, &payload,
                                                        recv_timeout)) < 0)
        {
            fprintf(stderr, "error getting recv reply: %d (%s)\n",
                    ret, dtn_strerror(dtn_errno(handle)));
            goto err;
        }

    //printf("deb1-ola!");
    //printf("%d",bundletype);
    //printf("%d",DTN_PAYLOAD_FILE);

        // Files need to be handled differently than memory transfers
        if ( bundletype =3D=3D DTN_PAYLOAD_FILE )
        {
        //printf("deb-in-ola!");
                handle_file_transfer(spec, payload, &total_bytes, i);
                dtn_free_payload(&payload);
                continue;
        }
//    printf("deb2-ola!");
        total_bytes +=3D payload.buf.buf_len;

        if (quiet) {
            dtn_free_payload(&payload);
            if (spec.blocks.blocks_len > 0) {
                free(spec.blocks.blocks_val);
                spec.blocks.blocks_val =3D NULL;
                spec.blocks.blocks_len =3D 0;
            }
            if (spec.metadata.metadata_len > 0) {
                free(spec.metadata.metadata_val);
                spec.metadata.metadata_val =3D NULL;
                spec.metadata.metadata_len =3D 0;
            }
            continue;
        }

        dtn_extension_block_t *block =3D spec.blocks.blocks_val;
        for (k =3D 0; k < spec.blocks.blocks_len; k++) {
            printf("Extension Block %i:\n", k);
            printf("\ttype =3D %i\n\tflags =3D %i\n",
                   block[k].type, block[k].flags);
            print_data(block[k].data.data_val, block[k].data.data_len);
        }

        dtn_extension_block_t *meta =3D spec.metadata.metadata_val;
        for (k =3D 0; k < spec.metadata.metadata_len; k++) {
            printf("Metadata Extension Block %i:\n", k);
            printf("\ttype =3D %i\n\tflags =3D %i\n",
                   meta[k].type, meta[k].flags);
            print_data(meta[k].data.data_val, meta[k].data.data_len);
        }

        print_data(payload.buf.buf_val, payload.buf.buf_len);

        if (doAppAcks) {
            dtn_bundle_id_t id;
            dtn_ack(handle, &spec, &id);
        }

        dtn_free_payload(&payload);
        if (spec.blocks.blocks_len > 0) {
            int i=3D0;
            for ( i=3D0; i<spec.blocks.blocks_len; i++ ) {
                free(spec.blocks.blocks_val[i].data.data_val);
            }
            free(spec.blocks.blocks_val);
            spec.blocks.blocks_val =3D NULL;
            spec.blocks.blocks_len =3D 0;
        }
        if (spec.metadata.metadata_len > 0) {
            int i=3D0;
            for ( i=3D0; i<spec.metadata.metadata_len; i++ ) {
                free(spec.metadata.metadata_val[i].data.data_val);
            }
            free(spec.metadata.metadata_val);
            spec.metadata.metadata_val =3D NULL;
            spec.metadata.metadata_len =3D 0;
        }
    }


done:
    dtn_close(handle);
    return 0;

err:
    dtn_close(handle);
    return 1;
}


Respects,
Carlos Neves Abrantes, Andr=E9 Carvalho
Communication Networks Engineering
Instituto Superior T=E9cnico - Portugal

--0016e6d7f0b61b66d704d01c3d20
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Streaming Video with dtn2 and vlc<br><div class=3D"gmail_quote">Our team is=
 trying compare dtn2 and Ibr-dtn performance in video streaming to write a =
paper about this technologies.<br>I have troubles to send a stream video in=
 dtn2, because dtnsend does not work as i wanted for the flag &quot;f&quot;=
 (file).<br>

Changing apps/dtnrecv.c, and do the /configure , make , make install again =
, now i can send videos from a computer to another.<br>You have any solutio=
n to do stream of video or sending files without changing dtnrecv.c origina=
l file? <br>

I&#39;m using dtnd version 2.9.0<br><br>To receive the stream i&#39;m using=
:<br>receiver: dtnrecv dtn://carlos.dtn/r | vlc -<br>It works for remote co=
mmunications with other computers.<br><br><br>You have a copy above with th=
e modifications we have made.<br>

dtnrecv.c<br>/*<br>=A0*=A0=A0=A0 Copyright 2004-2006 Intel Corporation<br>=
=A0* <br>=A0*=A0=A0=A0 Licensed under the Apache License, Version 2.0 (the =
&quot;License&quot;);<br>=A0*=A0=A0=A0 you may not use this file except in =
compliance with the License.<br>

=A0*=A0=A0=A0 You may obtain a copy of the License at<br>=A0* <br>=A0*=A0=
=A0=A0=A0=A0=A0=A0 <a href=3D"http://www.apache.org/licenses/LICENSE-2.0" t=
arget=3D"_blank">http://www.apache.org/licenses/LICENSE-2.0</a><br>=A0* <br=
>=A0*=A0=A0=A0 Unless required by applicable law or agreed to in writing, s=
oftware<br>

=A0*=A0=A0=A0 distributed under the License is distributed on an &quot;AS I=
S&quot; BASIS,<br>=A0*=A0=A0=A0 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIN=
D, either express or implied.<br>=A0*=A0=A0=A0 See the License for the spec=
ific language governing permissions and<br>

=A0*=A0=A0=A0 limitations under the License.<br>=A0*/<br><br>#ifdef HAVE_CO=
NFIG_H<br>#=A0 include &lt;dtn-config.h&gt;<br>#endif<br><br>#include &lt;s=
tdio.h&gt;<br>#include &lt;unistd.h&gt;<br>#include &lt;errno.h&gt;<br>#inc=
lude &lt;strings.h&gt;<br>

#include &lt;string.h&gt;<br>#include &lt;stdlib.h&gt;<br>#include &lt;sys/=
time.h&gt;<br>#include &lt;sys/stat.h&gt;<br>#include &lt;fcntl.h&gt;<br>#i=
nclude &quot;dtn_api.h&quot;<br><br>#define BUFSIZE 16<br>#define BLOCKSIZE=
 8192<br>

#define COUNTER_MAX_DIGITS 9<br><br>// Find the maximum commandline length<=
br>#ifdef __FreeBSD__<br>/* Needed for PATH_MAX, Linux doesn&#39;t need it =
*/<br>#include &lt;sys/syslimits.h&gt;<br>#endif<br><br>#ifndef PATH_MAX<br=
>

/* A conservative fallback */<br>#define PATH_MAX 1024<br>#endif<br><br>con=
st char *progname;<br><br>// Daemon connection<br>int api_IP_set =3D 0;<br>=
char * api_IP =3D &quot;127.0.0.1&quot;;<br>short api_port =3D 5010;<br><br=
>
int=A0=A0 verbose=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =3D 0;=A0=A0=A0 =A0=A0=A0 /=
/ verbose output<br>
int=A0=A0 doAppAcks=A0=A0=A0=A0=A0=A0=A0=A0 =3D 0;=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0 // Application ack of received bundles<br>int=A0=A0 quiet=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =3D 0;=A0=A0=A0 =A0=A0=A0 // quiet output<br=
>char* endpoint=A0=A0=A0 =A0=A0=A0 =3D NULL; =A0=A0=A0 // endpoint for regi=
stration<br>dtn_reg_id_t regid=A0=A0=A0 =3D DTN_REGID_NONE;// registration =
id<br>

int=A0=A0 expiration=A0=A0=A0 =3D 30; =A0=A0=A0 =A0=A0=A0 // registration e=
xpiration time<br>int=A0=A0 count=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =3D 0=
;=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 // exit after count bundles received<br>=
int=A0=A0 failure_action=A0=A0=A0 =3D DTN_REG_DEFER;// registration deliver=
y failure action<br>

char* failure_script=A0=A0=A0 =3D &quot;&quot;;=A0=A0=A0 =A0=A0=A0=A0 // sc=
ript to exec<br>int=A0=A0 replay_action=A0=A0=A0 =3D DTN_REPLAY_NEW;// regi=
stration delivery replay semantics<br>int=A0=A0 register_only=A0=A0=A0 =3D =
0;=A0=A0=A0 =A0=A0=A0 // register and quit<br>int=A0=A0 change=A0=A0=A0 =A0=
=A0=A0 =3D 0;=A0=A0=A0 =A0=A0=A0 // change existing registration <br>

int=A0=A0 unregister=A0=A0=A0 =3D 0;=A0=A0=A0 =A0=A0=A0 // remove existing =
registration <br>int=A0=A0 recv_timeout=A0=A0=A0 =3D -1;=A0=A0=A0 =A0=A0=A0=
 // timeout to dtn_recv call<br>int=A0=A0 no_find_reg=A0=A0=A0 =3D 0;=A0=A0=
=A0 =A0=A0=A0 // omit call to dtn_find_registration<br>char filename[PATH_M=
AX];=A0=A0=A0 =A0=A0=A0 // Destination filename for file xfers<br>

dtn_bundle_payload_location_t bundletype =3D DTN_PAYLOAD_MEM;<br><br>void<b=
r>usage()<br>{<br>=A0=A0=A0 fprintf(stderr, &quot;usage: %s [opts] &lt;endp=
oint&gt; \n&quot;, progname);<br>=A0=A0=A0 fprintf(stderr, &quot;options:\n=
&quot;);<br>

=A0=A0=A0 fprintf(stderr, &quot; -A daemon api IP address\n&quot;);<br>=A0=
=A0=A0 fprintf(stderr, &quot; -B daemon api IP port\n&quot;);<br>=A0=A0=A0 =
fprintf(stderr, &quot; -a Application acknowledgement of received bundles (=
to daemon)\n&quot;);<br>

=A0=A0=A0 fprintf(stderr, &quot; -v verbose\n&quot;);<br>=A0=A0=A0 fprintf(=
stderr, &quot; -q quiet\n&quot;);<br>=A0=A0=A0 fprintf(stderr, &quot; -h he=
lp\n&quot;);<br>=A0=A0=A0 fprintf(stderr, &quot; -d &lt;eid|demux_string&gt=
; endpoint id\n&quot;);<br>

=A0=A0=A0 fprintf(stderr, &quot; -r &lt;regid&gt; use existing registration=
 regid\n&quot;);<br>=A0=A0=A0 fprintf(stderr, &quot; -n &lt;count&gt; exit =
after count bundles received\n&quot;);<br>=A0=A0=A0 fprintf(stderr, &quot; =
-e &lt;time&gt; registration expiration time in seconds &quot;<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 &quot;(default: %d)\n&quot;, expiration);=
<br>=A0=A0=A0 fprintf(stderr, &quot; -f &lt;defer|drop|exec&gt; failure act=
ion\n&quot;);<br>=A0=A0=A0 fprintf(stderr, &quot; -R &lt;new|none|all&gt; r=
eplay action\n&quot;);<br>=A0=A0=A0 fprintf(stderr, &quot; -F &lt;script&gt=
; failure script for exec action\n&quot;);<br>

=A0=A0=A0 fprintf(stderr, &quot; -x call dtn_register and immediately exit\=
n&quot;);<br>=A0=A0=A0 fprintf(stderr, &quot; -c call dtn_change_registrati=
on and immediately exit\n&quot;);<br>=A0=A0=A0 fprintf(stderr, &quot; -u ca=
ll dtn_unregister and immediately exit\n&quot;);<br>

=A0=A0=A0 fprintf(stderr, &quot; -N don&#39;t try to find an existing regis=
tration\n&quot;);<br>=A0=A0=A0 fprintf(stderr, &quot; -t &lt;timeout&gt; ti=
meout value for call to dtn_recv\n&quot;);<br>=A0=A0=A0 fprintf(stderr, &qu=
ot; -o &lt;template&gt; Write out transfers to files using this template (#=
 chars are\n&quot;<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 &quot;replaced with a counter). Example: =
f##.bin goes to f00.bin, f01.bin, etc...\n&quot;);<br>}<br><br>void<br>pars=
e_options(int argc, char**argv)<br>{<br>=A0=A0=A0 int c, done =3D 0;<br><br=
>=A0=A0=A0 progname =3D argv[0];<br>

<br>=A0=A0=A0 memset(filename, 0, sizeof(char) * PATH_MAX);<br><br>=A0=A0=
=A0 while (!done)<br>=A0=A0=A0 {<br>=A0=A0=A0=A0=A0=A0=A0 c =3D getopt(argc=
, argv, &quot;aA:B:vqhHd:r:e:f:R:F:xn:cuNt:o:&quot;);<br>=A0=A0=A0=A0=A0=A0=
=A0 switch (c)<br>=A0=A0=A0=A0=A0=A0=A0 {<br>=A0=A0=A0=A0=A0=A0=A0 case &#3=
9;a&#39;:<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 doAppAcks =3D 1;<br>=A0=A0=A0=A0=A0=A0=A0=
 case &#39;A&#39;:<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 api_IP_set =3D 1;<b=
r>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 api_IP =3D optarg;<br>=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0 break;<br>=A0=A0=A0=A0=A0=A0=A0 case &#39;B&#39;:<br>=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 api_port =3D atoi(optarg);<br>=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0 break;=A0=A0=A0 <br>

=A0=A0=A0=A0=A0=A0=A0 case &#39;v&#39;:<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0 verbose =3D 1;<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 break;<br>=A0=A0=A0=
=A0=A0=A0=A0 case &#39;q&#39;:<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 quiet =
=3D 1;<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 break;<br>=A0=A0=A0=A0=A0=A0=A0=
 case &#39;h&#39;:<br>=A0=A0=A0=A0=A0=A0=A0 case &#39;H&#39;:<br>=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0 usage();<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 exit(0);<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0 return;<br>=A0=A0=A0=A0=A0=A0=A0 case &#39;r&#39;:<br>=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0 regid =3D atoi(optarg);<br>=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0 break;<br>=A0=A0=A0=A0=A0=A0=A0 case &#39;e&#39;:<br>=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0 expiration =3D atoi(optarg);<br>=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0 break;<br>

=A0=A0=A0=A0=A0=A0=A0 case &#39;f&#39;:<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0 if (!strcasecmp(optarg, &quot;defer&quot;)) {<br>=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0 failure_action =3D DTN_REG_DEFER;<br><br>=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0 } else if (!strcasecmp(optarg, &quot;drop&quot;)) =
{<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 failure_action =3D DTN_R=
EG_DROP;<br>

<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 } else if (!strcasecmp(optarg, &quot;=
exec&quot;)) {<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 failure_act=
ion =3D DTN_REG_EXEC;<br><br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 } else {<br>=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 fprintf(stderr, &quot;invalid=
 failure action &#39;%s&#39;\n&quot;, optarg);<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 usage();<br>=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 exit(1);<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0 }<br>=A0=A0=A0=A0=A0=A0=A0 case &#39;R&#39;:<br>=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0 if (!strcasecmp(optarg, &quot;new&quot;)) {<br>=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 replay_action =3D DTN_REPLAY_NEW;<br><br>=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 } else if (!strcasecmp(optarg, &quot;none&qu=
ot;)) {<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 replay_action =3D DTN_REPLAY_=
NONE;<br><br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 } else if (!strcasecmp(optar=
g, &quot;all&quot;)) {<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 rep=
lay_action =3D DTN_REPLAY_ALL;<br><br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 } e=
lse {<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 fprintf(stderr, &quo=
t;invalid replay action &#39;%s&#39;\n&quot;, optarg);<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 usage();<br>=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 exit(1);<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0 }<br>=A0=A0=A0=A0=A0=A0=A0 case &#39;F&#39;:<br>=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0 failure_script =3D optarg;<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0 break;<br>=A0=A0=A0=A0=A0=A0=A0 case &#39;x&#39;:<br>=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0 register_only =3D 1;<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 break;<br>=A0=A0=A0=A0=A0=A0=A0 case &#39=
;n&#39;:<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 count =3D atoi(optarg);<br>=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 break;<br>=A0=A0=A0=A0=A0=A0=A0 case &#39=
;c&#39;:<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 change =3D 1;<br>=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0 break;<br>=A0=A0=A0=A0=A0=A0=A0 case &#39;u&#39;:<br>=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 unregister =3D 1;<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 break;<br>=A0=A0=A0=A0=A0=A0=A0 case &#39=
;N&#39;:<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 no_find_reg =3D 1;<br>=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0 break;<br>=A0=A0=A0=A0=A0=A0=A0 case &#39;t&#39=
;:<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 recv_timeout =3D atoi(optarg);<br>=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 break;<br>=A0=A0=A0=A0=A0=A0=A0 case &#39=
;o&#39;:<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 strncpy(filename, optarg, PATH_MAX);<br>=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 break;<br>=A0=A0=A0=A0=A0=A0=A0 case -1:<=
br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 done =3D 1;<br>=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0 break;<br>=A0=A0=A0=A0=A0=A0=A0 default:<br>=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0 // getopt already prints an error message for unknown<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 // option characters<br>=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0 usage();<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 exit(1);<b=
r>=A0=A0=A0=A0=A0=A0=A0 }<br>=A0=A0=A0 }<br><br>=A0=A0=A0 endpoint =3D argv=
[optind];<br>=A0=A0=A0 if (!endpoint &amp;&amp; (regid =3D=3D DTN_REGID_NON=
E)) {<br>=A0=A0=A0=A0=A0=A0=A0 fprintf(stderr, &quot;must specify either an=
 endpoint or a regid\n&quot;);<br>

=A0=A0=A0=A0=A0=A0=A0 usage();<br>=A0=A0=A0=A0=A0=A0=A0 exit(1);<br>=A0=A0=
=A0 }<br><br>=A0=A0=A0 if ((change || unregister) &amp;&amp; (regid =3D=3D =
DTN_REGID_NONE)) {<br>=A0=A0=A0=A0=A0=A0=A0 fprintf(stderr, &quot;must spec=
ify regid when using -%c option\n&quot;,<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0 change ? &#39;c&#39; : &#39;u&#39;);<br>

=A0=A0=A0=A0=A0=A0=A0 usage();<br>=A0=A0=A0=A0=A0=A0=A0 exit(1);<br>=A0=A0=
=A0 }<br><br>=A0=A0=A0 if (failure_action =3D=3D DTN_REG_EXEC &amp;&amp; fa=
ilure_script =3D=3D NULL) {<br>=A0=A0=A0=A0=A0=A0=A0 fprintf(stderr, &quot;=
failure action EXEC must supply script\n&quot;);<br>=A0=A0=A0=A0=A0=A0=A0 u=
sage();<br>

=A0=A0=A0=A0=A0=A0=A0 exit(1);<br>=A0=A0=A0 }<br><br>=A0=A0=A0 // the defau=
lt is to use memory transfer mode, but if someone specifies a<br>=A0=A0=A0 =
// filename then we need to tell the API to expect a file<br>=A0=A0=A0 if (=
 filename[0] !=3D &#39;\0&#39; )<br>

=A0=A0=A0=A0=A0=A0=A0 bundletype =3D DTN_PAYLOAD_FILE;<br><br>}<br><br><br>=
static void<br>print_data(char* buffer, u_int length)<br>{<br>=A0=A0=A0 fwr=
ite(buffer,1,length,stdout);<br>}<br><br>/* -------------------------------=
---------------------------------------- */<br>

/* Builds the temporary file based on the template given and an integer<br>=
=A0* counter value<br>=A0*/<br>int buildfilename(char* template, char* newf=
ilename, int counter )<br>{<br>=A0=A0=A0 char counterasstring[COUNTER_MAX_D=
IGITS];<br>

=A0=A0=A0 char formatstring[10];<br>=A0=A0=A0 char* startloc;<br>=A0=A0=A0 =
char* endloc;<br>=A0=A0=A0 int templatelen;<br><br>=A0=A0=A0 strcpy(newfile=
name, template);<br><br>=A0=A0=A0 endloc =3D rindex(newfilename, &#39;#&#39=
;);<br>=A0=A0=A0 /* No template in the filename, just copy it as is */<br>

=A0=A0=A0 if ( endloc =3D=3D NULL )<br>=A0=A0=A0=A0=A0=A0=A0 return 0;<br>=
=A0=A0=A0=A0=A0=A0=A0 <br>=A0=A0=A0 /* Search backwards for the start of th=
e template */<br>=A0=A0=A0 for ( startloc =3D endloc; *startloc =3D=3D &#39=
;#&#39; &amp;&amp; startloc !=3D template; <br>=A0=A0=A0=A0=A0=A0=A0=A0=A0 =
startloc -=3D 1 );<br>

<br>=A0=A0=A0 startloc +=3D 1;<br><br>=A0=A0=A0 templatelen =3D endloc - st=
artloc + 1;<br>=A0=A0=A0 if ( templatelen &gt; COUNTER_MAX_DIGITS )<br>=A0=
=A0=A0=A0=A0=A0=A0 templatelen =3D COUNTER_MAX_DIGITS;<br><br>=A0=A0=A0 spr=
intf(formatstring, &quot;%%0%dd&quot;, templatelen);<br>

=A0=A0=A0 sprintf(counterasstring, formatstring, counter);<br><br>=A0=A0=A0=
 if ( strlen(counterasstring) &gt; (unsigned int)templatelen )<br>=A0=A0=A0=
=A0=A0=A0=A0 fprintf(stderr, &quot;Warning: Filename template not large eno=
ugh &quot;<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 &quot;to suppor=
t counter value %d\n&quot;, counter);<br>

<br>=A0=A0=A0 memcpy(startloc, counterasstring, sizeof(char) * templatelen)=
;<br><br>=A0=A0=A0 return 0;<br>}<br><br>/* -------------------------------=
---------------------------------------- */<br>/* File transfers suffer con=
siderably from the inability to safely send <br>

=A0* metadata on the same channel as the file transfer in DTN.=A0 Perhaps w=
e <br>=A0* should work around this?<br>=A0*/<br>int<br>handle_file_transfer=
(dtn_bundle_spec_t spec, dtn_bundle_payload_t payload,<br>=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 int* total_bytes, int counter=
)<br>

{<br>=A0=A0=A0 int tempdes;<br>=A0=A0=A0 int destdes;<br>=A0=A0=A0 char blo=
ck[BLOCKSIZE];<br>=A0=A0=A0 ssize_t bytesread;<br>=A0=A0=A0 struct stat fil=
einfo;<br>=A0=A0=A0 char currentfile[PATH_MAX];<br><br>=A0=A0=A0 // Create =
the filename by searching for ### characters in the given<br>

=A0=A0=A0 // filename and replacing that with an incrementing counter.=A0 <=
br>=A0=A0=A0 buildfilename(filename, currentfile, counter);<br><br>=A0=A0=
=A0 // Try to rename the old file to the new name to avoid unnecessary copy=
ing<br>=A0=A0=A0 if (rename(filename, currentfile) =3D=3D 0) {<br>

=A0=A0=A0=A0=A0=A0=A0 // success!<br><br>=A0=A0=A0 } else {<br>=A0=A0=A0=A0=
=A0=A0=A0 // Copy the file into place<br>=A0=A0=A0=A0=A0=A0=A0 tempdes =3D =
open(payload.filename.filename_val, O_RDONLY);<br>=A0=A0=A0=A0=A0=A0=A0 <br=
>=A0=A0=A0=A0=A0=A0=A0 if ( tempdes &lt; 0 )<br>=A0=A0=A0=A0=A0=A0=A0 {<br>=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 fprintf(stderr, &quot;While opening the t=
emporary file for reading &#39;%s&#39;: %s\n&quot;,<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 payload.filename.=
filename_val, strerror(errno));<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 exit(1=
);<br>=A0=A0=A0=A0=A0=A0=A0 }<br><br>=A0=A0=A0=A0=A0=A0=A0 destdes =3D crea=
t(currentfile, 0644);<br>=A0=A0=A0=A0=A0=A0=A0 <br>=A0=A0=A0=A0=A0=A0=A0 if=
 ( destdes &lt; 0 )<br>=A0=A0=A0=A0=A0=A0=A0 {<br>=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0 fprintf(stderr, &quot;While opening output file for writing &#39;=
%s&#39;: %s\n&quot;,<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 filename, strerro=
r(errno));<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 exit(1);<br>=A0=A0=A0=A0=A0=
=A0=A0 }<br><br>=A0=A0=A0=A0=A0=A0=A0 // Duplicate the file<br>=A0=A0=A0=A0=
=A0=A0=A0 while ( (bytesread =3D read(tempdes, block, sizeof(block))) &gt; =
0 )<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 write(destdes, block, bytesread);<=
br>

<br>=A0=A0=A0=A0=A0=A0=A0 close(tempdes);<br>=A0=A0=A0=A0=A0=A0=A0 close(de=
stdes);<br>=A0=A0=A0=A0=A0=A0=A0 <br>=A0=A0=A0=A0=A0=A0=A0 unlink(payload.f=
ilename.filename_val);<br>=A0=A0=A0 }<br><br>=A0=A0=A0 if ( stat(currentfil=
e, &amp;fileinfo) =3D=3D -1 )<br>=A0=A0=A0 {<br>=A0=A0=A0=A0=A0=A0=A0 fprin=
tf(stderr, &quot;Unable to stat destination file &#39;%s&#39;: %s\n&quot;,<=
br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 currentfile, strerror(errno))=
;<br>=A0=A0=A0=A0=A0=A0=A0 return 1;<br>=A0=A0=A0 }=A0=A0=A0 <br><br>=A0=A0=
=A0 *total_bytes +=3D fileinfo.st_size;<br><br>=A0=A0=A0 return 0;<br>}<br>=
<br>int<br>main(int argc, char** argv)<br>{<br>=A0=A0=A0 int i;<br>=A0=A0=
=A0 u_int k;<br>

=A0=A0=A0 int ret;<br>=A0=A0=A0 int total_bytes =3D 0;<br>=A0=A0=A0 dtn_han=
dle_t handle;<br>=A0=A0=A0 dtn_endpoint_id_t local_eid;<br>=A0=A0=A0 dtn_re=
g_info_t reginfo;<br>=A0=A0=A0 dtn_bundle_spec_t spec;<br>=A0=A0=A0 dtn_bun=
dle_payload_t payload;<br>=A0=A0=A0 int call_bind;<br>

<br>=A0=A0=A0 // force stdout to always be line buffered, even if output is=
<br>=A0=A0=A0 // redirected to a pipe or file<br>=A0=A0=A0 setvbuf(stdout, =
(char *)NULL, _IOLBF, 0);<br>=A0=A0=A0 <br>=A0=A0=A0 progname =3D argv[0];<=
br><br>=A0=A0=A0 parse_options(argc, argv);<br>

=A0=A0=A0 <br>=A0=A0=A0 int err =3D 0;=A0 <br>=A0=A0=A0 if (api_IP_set) err=
 =3D dtn_open_with_IP(api_IP,api_port,&amp;handle);<br>=A0=A0=A0 else err =
=3D dtn_open(&amp;handle);=A0=A0=A0 <br><br>=A0=A0=A0 if (err !=3D DTN_SUCC=
ESS) {<br>=A0=A0=A0=A0=A0=A0=A0 fprintf(stderr, &quot;fatal error opening d=
tn handle: %s\n&quot;,<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 dtn_strerror(err));<br>=A0=A0=
=A0=A0=A0=A0=A0 exit(1);<br>=A0=A0=A0 }<br>=A0=A0=A0 <br>=A0=A0=A0 // if we=
&#39;re not given a regid, or we&#39;re in change mode, we need to<br>=A0=
=A0=A0 // build up the reginfo<br>=A0=A0=A0 memset(&amp;reginfo, 0, sizeof(=
reginfo));<br>

<br>=A0=A0=A0 if ((regid =3D=3D DTN_REGID_NONE) || change)<br>=A0=A0=A0 {<b=
r>=A0=A0=A0=A0=A0=A0=A0 // if the specified eid starts with &#39;/&#39;, th=
en build a local<br>=A0=A0=A0=A0=A0=A0=A0 // eid based on the configuration=
 of our dtn router plus the<br>=A0=A0=A0=A0=A0=A0=A0 // demux string. other=
wise make sure it&#39;s a valid one<br>

=A0=A0=A0=A0=A0=A0=A0 if (endpoint[0] =3D=3D &#39;/&#39;) {<br>=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0 dtn_build_local_eid(handle, &amp;local_eid, (char *) =
endpoint);<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <br>=A0=A0=A0=A0=A0=A0=A0 }=
 else {<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (dtn_parse_eid_string(&amp;=
local_eid, endpoint)) {<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 fprintf(stderr, &quot;invalid=
 destination endpoint &#39;%s&#39;\n&quot;,<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 endpoint);<br>=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0 goto err;<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =
}<br>=A0=A0=A0=A0=A0=A0=A0 }<br><br>=A0=A0=A0=A0=A0=A0=A0 // create a new r=
egistration based on this eid<br>

=A0=A0=A0=A0=A0=A0=A0 dtn_copy_eid(&amp;reginfo.endpoint, &amp;local_eid);<=
br>=A0=A0=A0=A0=A0=A0=A0 reginfo.regid=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =
=3D regid;<br>=A0=A0=A0=A0=A0=A0=A0 reginfo.expiration=A0=A0=A0=A0=A0=A0=A0=
 =3D expiration;<br>=A0=A0=A0=A0=A0=A0=A0 reginfo.flags=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0 =3D failure_action;<br>=A0=A0=A0=A0=A0=A0=A0 reginfo.rep=
lay_flags=A0=A0=A0=A0=A0 =3D replay_action;<br>

=A0=A0=A0=A0=A0=A0=A0 reginfo.script.script_val =3D failure_script;<br>=A0=
=A0=A0=A0=A0=A0=A0 reginfo.script.script_len =3D strlen(failure_script) + 1=
;<br>=A0=A0=A0 }<br><br>=A0=A0=A0 if (change) {<br>=A0=A0=A0=A0=A0=A0=A0 if=
 ((ret =3D dtn_change_registration(handle, regid, &amp;reginfo)) !=3D 0) {<=
br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 fprintf(stderr, &quot;error changing regi=
stration: %d (%s)\n&quot;,<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0 ret, dtn_strerror(dtn_errno(handle)));<br>=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0 goto err;<br>=A0=A0=A0=A0=A0=A0=A0 }<br>=A0=A0=A0=A0=A0=A0=
=A0 goto done;<br>=A0=A0=A0 }<br>=A0=A0=A0 <br>

=A0=A0=A0 if (unregister) {<br>=A0=A0=A0=A0=A0=A0=A0 if (dtn_unregister(han=
dle, regid) !=3D 0) {<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 fprintf(stderr, =
&quot;error in unregister regid %d: %s\n&quot;,<br>=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 regid, dtn_strerror(dtn_errno(handle)));<=
br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 goto err;<br>=A0=A0=A0=A0=A0=A0=A0 }<br>=
=A0=A0=A0=A0=A0=A0=A0 <br>=A0=A0=A0=A0=A0=A0=A0 goto done;<br>=A0=A0=A0 }<b=
r>=A0=A0=A0 <br>=A0=A0=A0 // try to see if there is an existing registratio=
n that matches<br>=A0=A0=A0 // the given endpoint, in which case we&#39;ll =
use that one.<br>

=A0=A0=A0 if (regid =3D=3D DTN_REGID_NONE &amp;&amp; ! no_find_reg) {<br>=
=A0=A0=A0=A0=A0=A0=A0 if (dtn_find_registration(handle, &amp;local_eid, &am=
p;regid) !=3D 0) {<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (dtn_errno(handl=
e) !=3D DTN_ENOTFOUND) {<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 f=
printf(stderr, &quot;error in find_registration: %s\n&quot;,<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 dtn_s=
trerror(dtn_errno(handle)));<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0 goto err;<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }<br>=A0=A0=A0=A0=A0=A0=
=A0 }<br>=A0=A0=A0=A0=A0=A0=A0 call_bind =3D 1;<br>=A0=A0=A0 }<br>=A0=A0=A0=
 <br>=A0=A0=A0 // if the user didn&#39;t give us a registration to use, get=
 a new one<br>

=A0=A0=A0 if (regid =3D=3D DTN_REGID_NONE) {<br>=A0=A0=A0=A0=A0=A0=A0 if ((=
ret =3D dtn_register(handle, &amp;reginfo, &amp;regid)) !=3D 0) {<br>=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0 fprintf(stderr, &quot;error creating registrati=
on: %d (%s)\n&quot;,<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0 ret, dtn_strerror(dtn_errno(handle)));<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 goto err;<br>=A0=A0=A0=A0=A0=A0=A0 }<br><=
br>=A0=A0=A0=A0=A0=A0=A0 call_bind =3D 0;<br>=A0=A0=A0 } else {<br>=A0=A0=
=A0=A0=A0=A0=A0 call_bind =3D 1;<br>=A0=A0=A0=A0=A0=A0=A0 dtn_parse_eid_str=
ing(&amp;local_eid, &quot;dtn://??/?&quot;);<br>=A0=A0=A0 }<br>=A0=A0=A0 <b=
r>=A0=A0=A0 if (register_only) {<br>

=A0=A0=A0=A0=A0=A0=A0 goto done;<br>=A0=A0=A0 }<br><br>=A0=A0=A0 if (call_b=
ind) {<br>=A0=A0=A0=A0=A0=A0=A0 // bind the current handle to the found reg=
istration<br>=A0=A0=A0=A0=A0=A0=A0 if (dtn_bind(handle, regid) !=3D 0) {<br=
>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 fprintf(stderr, &quot;error binding to r=
egistration: %s\n&quot;,<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 dtn_strerror(dtn_=
errno(handle)));<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 goto err;<br>=A0=A0=
=A0=A0=A0=A0=A0 }<br>=A0=A0=A0 }<br><br>=A0=A0=A0 <br>=A0=A0=A0 for (i =3D =
0; (count =3D=3D 0) || (i &lt; count); ++i) {<br>=A0=A0=A0=A0=A0=A0=A0 mems=
et(&amp;spec, 0, sizeof(spec));<br>

=A0=A0=A0=A0=A0=A0=A0 memset(&amp;payload, 0, sizeof(payload));<br><br>=A0=
=A0=A0 <br>=A0=A0=A0=A0=A0=A0=A0 if ((ret =3D dtn_recv(handle, &amp;spec, b=
undletype, &amp;payload, <br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 recv_timeout)) &lt; 0)<br>

=A0=A0=A0=A0=A0=A0=A0 {<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 fprintf(stderr=
, &quot;error getting recv reply: %d (%s)\n&quot;,<br>=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ret, dtn_strerror(dtn_errno(handle)));=
<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 goto err;<br>=A0=A0=A0=A0=A0=A0=A0 }<=
br><br>=A0=A0=A0 //printf(&quot;deb1-ola!&quot;);<br>

=A0=A0=A0 //printf(&quot;%d&quot;,bundletype);<br>=A0=A0=A0 //printf(&quot;=
%d&quot;,DTN_PAYLOAD_FILE);<br><br>=A0=A0=A0=A0=A0=A0=A0 // Files need to b=
e handled differently than memory transfers<br>=A0=A0=A0=A0=A0=A0=A0 if ( b=
undletype =3D=3D DTN_PAYLOAD_FILE )<br>
=A0=A0=A0=A0=A0=A0=A0 {<br>
=A0=A0=A0 =A0=A0=A0 //printf(&quot;deb-in-ola!&quot;);<br>=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 handle_file_transfer(spec, payload, &amp;tot=
al_bytes, i);<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 dtn_free_pay=
load(&amp;payload);<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 contin=
ue;<br>=A0=A0=A0=A0=A0=A0=A0 }<br>//=A0=A0=A0 printf(&quot;deb2-ola!&quot;)=
;<br>

=A0=A0=A0=A0=A0=A0=A0 total_bytes +=3D payload.buf.buf_len;<br><br>=A0=A0=
=A0=A0=A0=A0=A0 if (quiet) {<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 dtn_free_=
payload(&amp;payload);<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (spec.blocks=
.blocks_len &gt; 0) {<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 free=
(spec.blocks.blocks_val);<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 spec.blocks.blocks_val =3D NU=
LL;<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 spec.blocks.blocks_len=
 =3D 0;<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }<br>=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0 if (spec.metadata.metadata_len &gt; 0) {<br>=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0 free(spec.metadata.metadata_val);<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 spec.metadata.metadata_val =
=3D NULL;<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 spec.metadata.me=
tadata_len =3D 0;<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }<br>=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0 continue;<br>=A0=A0=A0=A0=A0=A0=A0 }<br><br>=A0=A0=A0=A0=
=A0=A0=A0 dtn_extension_block_t *block =3D spec.blocks.blocks_val;<br>

=A0=A0=A0=A0=A0=A0=A0 for (k =3D 0; k &lt; spec.blocks.blocks_len; k++) {<b=
r>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 printf(&quot;Extension Block %i:\n&quot=
;, k);<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 printf(&quot;\ttype =3D %i\n\tf=
lags =3D %i\n&quot;,<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0 block[k].type, block[k].flags);<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 print_data(block[k].data.data_val, block[=
k].data.data_len);<br>=A0=A0=A0=A0=A0=A0=A0 }<br><br>=A0=A0=A0=A0=A0=A0=A0 =
dtn_extension_block_t *meta =3D spec.metadata.metadata_val;<br>=A0=A0=A0=A0=
=A0=A0=A0 for (k =3D 0; k &lt; spec.metadata.metadata_len; k++) {<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 printf(&quot;Metadata Extension Block %i:=
\n&quot;, k);<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 printf(&quot;\ttype =3D =
%i\n\tflags =3D %i\n&quot;,<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0 meta[k].type, meta[k].flags);<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0 print_data(meta[k].data.data_val, meta[k].data.data_len);<br>

=A0=A0=A0=A0=A0=A0=A0 }<br><br>=A0=A0=A0=A0=A0=A0=A0 print_data(payload.buf=
.buf_val, payload.buf.buf_len);<br><br>=A0=A0=A0=A0=A0=A0=A0 if (doAppAcks)=
 {<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 dtn_bundle_id_t id;<br>=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0 dtn_ack(handle, &amp;spec, &amp;id);<br>=A0=A0=A0=A0=
=A0=A0=A0 }<br><br>=A0=A0=A0=A0=A0=A0=A0 dtn_free_payload(&amp;payload);<br=
>

=A0=A0=A0=A0=A0=A0=A0 if (spec.blocks.blocks_len &gt; 0) {<br>=A0=A0=A0=A0=
=A0=A0=A0 =A0=A0=A0 int i=3D0;<br>=A0=A0=A0=A0=A0=A0=A0 =A0=A0=A0 for ( i=
=3D0; i&lt;spec.blocks.blocks_len; i++ ) {<br>=A0=A0=A0=A0=A0=A0=A0 =A0=A0=
=A0 =A0=A0=A0 free(spec.blocks.blocks_val[i].data.data_val);<br>=A0=A0=A0=
=A0=A0=A0=A0 =A0=A0=A0 }<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 free(spec.blo=
cks.blocks_val);<br>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 spec.blocks.blocks_val =3D NULL;<br>=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 spec.blocks.blocks_len =3D 0;<br>=A0=A0=A0=
=A0=A0=A0=A0 }<br>=A0=A0=A0=A0=A0=A0=A0 if (spec.metadata.metadata_len &gt;=
 0) {<br>=A0=A0=A0=A0=A0=A0=A0 =A0=A0=A0 int i=3D0;<br>=A0=A0=A0=A0=A0=A0=
=A0 =A0=A0=A0 for ( i=3D0; i&lt;spec.metadata.metadata_len; i++ ) {<br>

=A0=A0=A0=A0=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 free(spec.metadata.metadata_val[i=
].data.data_val);<br>=A0=A0=A0=A0=A0=A0=A0 =A0=A0=A0 }<br>=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0 free(spec.metadata.metadata_val);<br>=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0 spec.metadata.metadata_val =3D NULL;<br>=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0 spec.metadata.metadata_len =3D 0;<br>

=A0=A0=A0=A0=A0=A0=A0 }<br>=A0=A0=A0 }<br><br>=A0=A0=A0 <br>done:<br>=A0=A0=
=A0 dtn_close(handle);<br>=A0=A0=A0 return 0;<br><br>err:<br>=A0=A0=A0 dtn_=
close(handle);<br>=A0=A0=A0 return 1;<br>}<br><div><br></div><div><br></div=
><div><span lang=3D"en"><span>Respects</span></span>,</div>

Carlos Neves Abrantes, Andr=E9 Carvalho<br>Communication Networks Engineeri=
ng<br>Instituto Superior T=E9cnico - Portugal<br>
</div><br>

--0016e6d7f0b61b66d704d01c3d20--

From carlosnevesabrantes@gmail.com  Wed Dec  5 11:19:15 2012
Return-Path: <carlosnevesabrantes@gmail.com>
X-Original-To: dtn-security@ietfa.amsl.com
Delivered-To: dtn-security@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 59DAC21F86A3 for <dtn-security@ietfa.amsl.com>; Wed,  5 Dec 2012 11:19:15 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.343
X-Spam-Level: 
X-Spam-Status: No, score=-2.343 tagged_above=-999 required=5 tests=[AWL=1.255,  BAYES_00=-2.599, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vIDXEMWtXyB2 for <dtn-security@ietfa.amsl.com>; Wed,  5 Dec 2012 11:19:11 -0800 (PST)
Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) by ietfa.amsl.com (Postfix) with ESMTP id 0172F21F84C2 for <dtn-security@ietfa.amsl.com>; Wed,  5 Dec 2012 11:19:10 -0800 (PST)
Received: by mail-wi0-f174.google.com with SMTP id hm9so1700705wib.7 for <dtn-security@ietfa.amsl.com>; Wed, 05 Dec 2012 11:19:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=2nXT0IJtx6Kw3ws8INChgTIAb1qODu5b8OibuMRuxXY=; b=YdIQ4o3Vu6jPlvRl7PcXLbgMXBwy9b24dFaqhPQk8WAkXzmYurhVtGvpiZSykwdgwW /+JTJGBmeUM1fzjNP6pycauCEL9nVXrhjejLkpNuykEu/v5758c/Vrt4aeebY9APN3Ul t12/ud4PB2R+Vj1Bo49YAFa6Wt4nFnQlfkAsNS6dPSDxhJeqN2czI9uirGoVm5FlqIEf VOabyVyPxcA+ay2PYveH7jtr8g53uXvQnb4S22Yv0pbr/RvCrva3jioZOE+B29zAeaAf AYkLNwLvwq6L7IlWd1qXHWhZ6/RBOqYvz4ih59+wdJ7NYpmxoA7DUjpvEw4eKomGYT4N 6qkQ==
MIME-Version: 1.0
Received: by 10.216.203.36 with SMTP id e36mr2372553weo.60.1354735149837; Wed, 05 Dec 2012 11:19:09 -0800 (PST)
Received: by 10.217.46.195 with HTTP; Wed, 5 Dec 2012 11:19:09 -0800 (PST)
Date: Wed, 5 Dec 2012 19:19:09 +0000
Message-ID: <CAJNAC68G4S5yODmzWAsNFDnDTT=_ggibLn7fiuW438k6edn_ww@mail.gmail.com>
From: Carlos Neves <carlosnevesabrantes@gmail.com>
To: dtn-security@ietfa.amsl.com
Content-Type: multipart/alternative; boundary=001636ef0d565eee8404d01fdbba
Subject: [dtn-security] Remove my email from the board... or my message
X-BeenThere: dtn-security@irtf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "The Delay-Tolerant Networking Research Group \(DTNRG\) - Security." <dtn-security.irtf.org>
List-Unsubscribe: <https://www.irtf.org/mailman/options/dtn-security>, <mailto:dtn-security-request@irtf.org?subject=unsubscribe>
List-Archive: <http://www.irtf.org/mail-archive/web/dtn-security>
List-Post: <mailto:dtn-security@irtf.org>
List-Help: <mailto:dtn-security-request@irtf.org?subject=help>
List-Subscribe: <https://www.irtf.org/mailman/listinfo/dtn-security>, <mailto:dtn-security-request@irtf.org?subject=subscribe>
X-List-Received-Date: Wed, 05 Dec 2012 19:19:15 -0000

--001636ef0d565eee8404d01fdbba
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Please remove my email from this site:
http://www.ietf.org/mail-archive/web/dtn-users/current/msg01598.html
I dont want spam in my email... And substitute "at" by "@" is the same
thing for Spammers.

If you cant remove/ocult my email. Please remove my message from this site.

Cumprimentos,
Carlos Neves Abrantes, n=BA65958
Bachelor in Communication Networks Engineering

--001636ef0d565eee8404d01fdbba
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Please remove my email from this site:=A0<a href=3D"http://www.ietf.org/mai=
l-archive/web/dtn-users/current/msg01598.html">http://www.ietf.org/mail-arc=
hive/web/dtn-users/current/msg01598.html</a><div>I dont want spam in my ema=
il... And substitute &quot;at&quot; by &quot;@&quot; is the same thing for =
Spammers.</div>
<div><div><br></div><div>If you cant remove/ocult my email. Please remove m=
y message from this site.<br><div><br></div><div>Cumprimentos,</div>Carlos =
Neves Abrantes, n=BA65958<br>Bachelor in Communication Networks Engineering=
<br>

</div></div>

--001636ef0d565eee8404d01fdbba--

From Bradley@NorthTech.US  Wed Dec  5 16:27:41 2012
Return-Path: <Bradley@NorthTech.US>
X-Original-To: dtn-security@ietfa.amsl.com
Delivered-To: dtn-security@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 5E23121F8CEB for <dtn-security@ietfa.amsl.com>; Wed,  5 Dec 2012 16:27:41 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.265
X-Spam-Level: 
X-Spam-Status: No, score=-2.265 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, IP_NOT_FRIENDLY=0.334]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yQZ5yO5SnJKd for <dtn-security@ietfa.amsl.com>; Wed,  5 Dec 2012 16:27:40 -0800 (PST)
Received: from gateway16.websitewelcome.com (gateway16.websitewelcome.com [69.56.225.11]) by ietfa.amsl.com (Postfix) with ESMTP id 62CDE21F8CE3 for <dtn-security@irtf.org>; Wed,  5 Dec 2012 16:27:40 -0800 (PST)
Received: by gateway16.websitewelcome.com (Postfix, from userid 5007) id D8E2D958BF300; Wed,  5 Dec 2012 18:27:27 -0600 (CST)
Received: from vanquish.websitewelcome.com (vanquish.websitewelcome.com [70.87.76.162]) by gateway16.websitewelcome.com (Postfix) with ESMTP id CBA32958BF2E0 for <dtn-security@irtf.org>; Wed,  5 Dec 2012 18:27:27 -0600 (CST)
Received: from [71.254.159.16] (port=51712 helo=[192.168.1.10]) by vanquish.websitewelcome.com with esmtpsa (TLSv1:DHE-RSA-CAMELLIA256-SHA:256) (Exim 4.80) (envelope-from <Bradley@NorthTech.US>) id 1TgPJT-0000Bo-Br for dtn-security@irtf.org; Wed, 05 Dec 2012 18:27:39 -0600
Message-ID: <50BFE6BB.2040106@NorthTech.US>
Date: Wed, 05 Dec 2012 16:28:43 -0800
From: "Bradley D. Thornton" <Bradley@NorthTech.US>
Organization: NorthTech Computer
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110501 Mnenhy/0.8.5 Thunderbird/3.1.10 ThunderBrowse/3.82
MIME-Version: 1.0
To: dtn-security@irtf.org
References: <CAJNAC68G4S5yODmzWAsNFDnDTT=_ggibLn7fiuW438k6edn_ww@mail.gmail.com>
In-Reply-To: <CAJNAC68G4S5yODmzWAsNFDnDTT=_ggibLn7fiuW438k6edn_ww@mail.gmail.com>
X-Enigmail-Version: 1.1.2
X-TagToolbar-Keys: D20121205162843373
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - vanquish.websitewelcome.com
X-AntiAbuse: Original Domain - irtf.org
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - NorthTech.US
X-BWhitelist: yes
X-Source: 
X-Source-Args: 
X-Source-Dir: 
X-Source-Sender: ([192.168.1.10]) [71.254.159.16]:51712
X-Source-Auth: bradley@northtech.us
X-Email-Count: 1
X-Source-Cap: dGFsbHNoaXA7dGFsbHNoaXA7dmFucXVpc2gud2Vic2l0ZXdlbGNvbWUuY29t
Subject: Re: [dtn-security] Remove my email from the board... or my message
X-BeenThere: dtn-security@irtf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "The Delay-Tolerant Networking Research Group \(DTNRG\) - Security." <dtn-security.irtf.org>
List-Unsubscribe: <https://www.irtf.org/mailman/options/dtn-security>, <mailto:dtn-security-request@irtf.org?subject=unsubscribe>
List-Archive: <http://www.irtf.org/mail-archive/web/dtn-security>
List-Post: <mailto:dtn-security@irtf.org>
List-Help: <mailto:dtn-security-request@irtf.org?subject=help>
List-Subscribe: <https://www.irtf.org/mailman/listinfo/dtn-security>, <mailto:dtn-security-request@irtf.org?subject=subscribe>
X-List-Received-Date: Thu, 06 Dec 2012 00:27:41 -0000

-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160



On 12/05/2012 11:19 AM, Carlos Neves wrote:
> Please remove my email from this site:
> http://www.ietf.org/mail-archive/web/dtn-users/current/msg01598.html
> I dont want spam in my email... And substitute "at" by "@" is the same
> thing for Spammers.

Why don't you just RTFM and remove yourself from the list?



- -- 
Bradley D. Thornton
Manager Network Services
NorthTech Computer
TEL: +1.310.388.9469  (US)
TEL: +44.203.318.2755 (UK)
TEL: +41.43.508.05.10 (CH)
http://NorthTech.US

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Find this cert at x-hkp://pool.sks-keyservers.net

iQEcBAEBAwAGBQJQv+a7AAoJEE1wgkIhr9j3qSgH/20dhrOxW0VM25+GFP/Ia2J8
BdYX2lwZc3YRbkb9BBsIHcjTwK1diICSRq1p9YApB5yF8xsDzZJrhCLiah7acD1V
FHVseLldYwaYP+/ww9/ZNO+q54OOi50VVNWrx7uUOCzjFpiNcrXUDV1BzXWdL0v7
H5H2p46hILmoGJ/Uq/EPOUOrXgtQ0nesnvKrNzjeVp48Xjj+7i8w7Apy7uIodT1+
Ei+b3xShoujz1t/+SlBvASIv6ors1jlIwLOjbVLLl3tCsNvH0kcAo+fPYx72c9LN
8TCEPs+4yWyh+kYVNu5938pHJhT2VjqKx/lp0yWTMZ+h4aJA1+YMDWEhhU9hzIA=
=Fdz8
-----END PGP SIGNATURE-----

From stephen.farrell@cs.tcd.ie  Wed Dec  5 16:31:00 2012
Return-Path: <stephen.farrell@cs.tcd.ie>
X-Original-To: dtn-security@ietfa.amsl.com
Delivered-To: dtn-security@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D645221F8B2A for <dtn-security@ietfa.amsl.com>; Wed,  5 Dec 2012 16:31:00 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -102.573
X-Spam-Level: 
X-Spam-Status: No, score=-102.573 tagged_above=-999 required=5 tests=[AWL=0.026, BAYES_00=-2.599, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id K673AWa2II9C for <dtn-security@ietfa.amsl.com>; Wed,  5 Dec 2012 16:30:59 -0800 (PST)
Received: from mercury.scss.tcd.ie (mercury.scss.tcd.ie [134.226.56.6]) by ietfa.amsl.com (Postfix) with ESMTP id C9DB721F8BD4 for <dtn-security@irtf.org>; Wed,  5 Dec 2012 16:30:59 -0800 (PST)
Received: from localhost (localhost [127.0.0.1]) by mercury.scss.tcd.ie (Postfix) with ESMTP id 0B8DEBE58; Thu,  6 Dec 2012 00:30:38 +0000 (GMT)
X-Virus-Scanned: Debian amavisd-new at scss.tcd.ie
Received: from mercury.scss.tcd.ie ([127.0.0.1]) by localhost (mercury.scss.tcd.ie [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IOL+aaUUsOhn; Thu,  6 Dec 2012 00:30:33 +0000 (GMT)
Received: from [10.87.48.3] (unknown [86.46.17.194]) by mercury.scss.tcd.ie (Postfix) with ESMTPSA id 3D8FDBE55; Thu,  6 Dec 2012 00:30:33 +0000 (GMT)
Message-ID: <50BFE729.3050408@cs.tcd.ie>
Date: Thu, 06 Dec 2012 00:30:33 +0000
From: Stephen Farrell <stephen.farrell@cs.tcd.ie>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0
MIME-Version: 1.0
To: "Bradley D. Thornton" <Bradley@NorthTech.US>
References: <CAJNAC68G4S5yODmzWAsNFDnDTT=_ggibLn7fiuW438k6edn_ww@mail.gmail.com> <50BFE6BB.2040106@NorthTech.US>
In-Reply-To: <50BFE6BB.2040106@NorthTech.US>
X-Enigmail-Version: 1.4.6
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Cc: dtn-security@irtf.org
Subject: Re: [dtn-security] Remove my email from the board... or my message
X-BeenThere: dtn-security@irtf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "The Delay-Tolerant Networking Research Group \(DTNRG\) - Security." <dtn-security.irtf.org>
List-Unsubscribe: <https://www.irtf.org/mailman/options/dtn-security>, <mailto:dtn-security-request@irtf.org?subject=unsubscribe>
List-Archive: <http://www.irtf.org/mail-archive/web/dtn-security>
List-Post: <mailto:dtn-security@irtf.org>
List-Help: <mailto:dtn-security-request@irtf.org?subject=help>
List-Subscribe: <https://www.irtf.org/mailman/listinfo/dtn-security>, <mailto:dtn-security-request@irtf.org?subject=subscribe>
X-List-Received-Date: Thu, 06 Dec 2012 00:31:01 -0000

Folks. Neither mail to the list was needed, so let's
leave it at that. Follow up, if you must, offlist.
Thanks,
S.

On 12/06/2012 12:28 AM, Bradley D. Thornton wrote:
> 
> 
> On 12/05/2012 11:19 AM, Carlos Neves wrote:
>> Please remove my email from this site:
>> http://www.ietf.org/mail-archive/web/dtn-users/current/msg01598.html
>> I dont want spam in my email... And substitute "at" by "@" is the same
>> thing for Spammers.
> 
> Why don't you just RTFM and remove yourself from the list?
> 
> 
> 
> _______________________________________________
> dtn-security mailing list
> dtn-security@irtf.org
> https://www.irtf.org/mailman/listinfo/dtn-security
> 
> 
