diff -r 000000000000 -r 2b3e5ec03512 apps/tca_admin/tca_admin.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/apps/tca_admin/tca_admin.cc Thu Apr 21 14:57:45 2011 +0100 @@ -0,0 +1,200 @@ +/* + * Copyright 2005-2006 University of Waterloo + * + * 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 +#endif + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "dtn_api.h" +#include "TcaController.h" + +static const int debug = 1; + +static const int MAX_TTL = 604800; // 604800 seconds == 1 week + +// parsed from command line args +static const char* progname; +static std::string node_type = "mobile"; +static bool tidy = false; // discard pending bundles on startup +static std::string link_id; // published link id of node +static std::string ask_addr; // clayer address to send ask to +static std::string adv_string; // published adv string +static int registry_ttl = MAX_TTL; // registry entry ttl +static int control_ttl = MAX_TTL; // control bundle ttl + + +static TcaController::Role role = TcaController::TCA_MOBILE; + + +void +print_usage() +{ + fprintf(stderr, "usage: %s [opts]\n" + "options:\n" + " -h help\n" + " -n (default = mobile)\n" + " -l local contact addr (required for gateway only)\n" + " -a send ask on startup\n" + " -d string to send in response to ASK\n" + " -r