#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include "trek_toolkit_common_api.h"
#include "trek.h"
#include <string>
#ifdef _WIN32
#include <windows.h>
#endif
using namespace std;
unsigned int message_mask;
bool suspend_flag;
{
if (mess_struct_ptr->
category & message_mask)
{
printf("%s%s\n",
}
}
void DeviceData(const char *device_key,
int32_t packet_length,
uint8_t *packet_buffer_ptr)
{
unsigned int count;
for (count = 0; count*
sizeof(
cfdp_struct_type) < (
unsigned int)packet_length; count++)
{
{
printf(
"Message %s\n",cfdp_struct_ptr->
message);
}
{
{
printf("Progress Transaction %s -> %s\t file size=%lld\t bytes trans=%lld\t percent trans=%u%%\n",
}
}
}
}
static void Argu( char *buffer,
uint32_t arg_size,
char *arg[],
uint32_t *arg_count)
{
char *token;
for (uint32_t i = 0; i < arg_size; i++)
{
arg[i] = NULL;
}
arg[0] = strtok(buffer," \r\n");
token = arg[0];
*arg_count=0;
while (token != NULL && *arg_count < arg_size)
{
arg[*arg_count] = token;
token = strtok(NULL," \r\n");
*arg_count += 1;
}
}
#ifdef _WIN32
BOOL CtrlHandler( DWORD fdwCtrlType )
{
switch( fdwCtrlType )
{
case CTRL_BREAK_EVENT:
{
if (!suspend_flag)
{
suspend_flag = true;
}
printf("Info Suspend all CFDP transactions.\n");
return true;
}
default:
return FALSE;
}
}
#else
void SigHandler(int32_t sig)
{
if (!suspend_flag)
{
suspend_flag = true;
}
printf("\nInfo Suspend all CFDP transactions.\n");
}
#endif
static void HelpCfdp()
{
printf("**************************************************** Command Primitives For The CFDP Console Application ****************************************************\n\n");
{
printf("\tTo execute a CFDP primitive <action> <life>/<cos>/<ord>/<mode>/<criticality> <\"source_pname\"> <dest eid> <\"dest_pname\">\n");
printf("\t put file example: put <class1,class2> \"D:/test a\" 100 \"D:/test b\"\n");
printf("\t put directory of files example: put <class1,class2> \"D:/test_dir/\" 100 \"D:/test_dir/\"\n");
printf("\t get file example: get <class1,class2> \"D:/test a\" 100 \"D:/test b\"\n");
printf("\t get directory of files example: get <class1,class2> \"D:/test_dir/\" 100 \"D:/test_dir/\"\n");
printf("\t create file example: create_file <class1,class2> \"D:/test a\" 100 \n");
printf("\t rename file example: rename_file <class1,class2> \"D:/test a\" 100 \"D:/test b\"\n");
printf("\t message example: message <class1,class2> \"Hello World\" 100 \n");
printf("\t bit rate example: bit_rate <class1,class1> 1000000 100 \n");
printf("\t close rec file example: close_rec_file <class1,class2> \"record library name\" 100 \"record file name\"\n");
printf("\t close rec file example: close_rec_file <class1,class2> \"record library name\" 100 \n");
printf("\tTo add a CFDP primitive to a list add <action> <class1,class2> <\"source_pname\"> <dest eid> <\"dest_pname\">\n");
printf("\t add put example: add put <class1,class2> \"D:/test a/\" 100 \"D:/test b/\"\n");
printf("\t add get example: add get <class1,class2> \"D:/test a/\" 100 \"D:/test b/\"\n");
printf("\t add delete file example: add delete_file <class1,class2> \"D:/test a\" 100 \n");
printf("\t add append file example: add append_file <class1,class2> \"D:/test a\" 100 \"D:/test b\"\n");
printf("\t add message example: add message <class1,class2> \"Goodbye World\" 100 \n");
printf("\t add bit rate example: add bit_rate <class1,class2> 1000000 100 \n");
printf("\t add close rec file example: add close_rec_file <class1,class2> \"record library name\" 100 \"record file name\"\n");
}
{
printf("\tTo execute a CFDP primitive <action> <life>/<cos>/<ord>/<mode>/<criticality> <\"source_pname\"> <dest eid> <\"dest_pname\">\n");
printf("\t put example: put 86400/STD_PRIORITY/0/ASSURED/NOT_CRITICAL \"D:/test a\" 100 \"D:/test b\"\n");
printf("\t put directory of files example: put 86400/STD_PRIORITY/0/ASSURED/NOT_CRITICAL \"D:/test_dir/\" 100 \"D:/test_dir/\"\n");
printf("\t get example: get / \"D:/test a\" 100 \"D:/test b\"\n");
printf("\t get directory of files example: get / \"D:/test_dir/\" 100 \"D:/test_dir/\"\n");
printf("\t create file example: create_file /STD_PRIORITY/// \"D:/test a\" 100 \n");
printf("\t rename file example: rename_file //// \"D:/test a\" 100 \"D:/test b\"\n");
printf("\t message example: message 3600////NOT_CRITICAL \"Hello World\" 100 \n");
printf("\t close rec file example: close_rec_file //// \"record library name\" 100 \"record file name\"\n");
printf("\t close rec file example: close_rec_file //// \"record library name\" 100 \n");
printf("\tTo add a CFDP primitive to a list add <action> <life>/<cos>/<ord>/<mode>/<criticality> <\"source_pname\"> <dest eid> <\"dest_pname\">\n");
printf("\t add put example: add put 86400/STD_PRIORITY/0/ASSURED/NOT_CRITICAL \"D:/test a/\" 100 \"D:/test b/\"\n");
printf("\t add get example: add get ///ASSURED_WITH_CUSTODY_TRANSFER/ \"D:/test a/\" 100 \"D:/test b/\"\n");
printf("\t add delete file example: add delete_file /STD_PRIORITY/// \"D:/test a\" 100 \n");
printf("\t add append file example: add append_file / \"D:/test a\" 100 \"D:/test b\"\n");
printf("\t add message example: add message 3600////NOT_CRITICAL \"Goodbye World\" 100 \n");
printf("\t add close rec file example: add close_rec_file //// \"record library name\" 100 \"record file name\"\n");
}
printf("\tTo display a list of CFDP primitive actions display actions\n");
printf("\tTo read a file of primitives and add to a list process <\"primitive pathname\">\n");
printf("\t (e.g., process \"./toolkit_cfdp_primitives.txt\")\n");
printf("\tTo remove all primitives from a list remove\n");
printf("\tTo send/execute all primitives in a list send\n");
printf("\tTo record all primitives in a list record prim <\"pathname\">\n");
printf("\t (e.g., record prim \"./cfdp_prim.txt\")\n");
printf("\tTo suspend all CFDP transactions windows os: ctrl-break or ctrl-fn-pause or ctrl-fn-right shift or suspend\n");
printf("\t linux os: ctrl-c or suspend\n");
printf("\tTo resume all CFDP transactions resume\n");
printf("\tTo cancel a CFDP transaction cancel <transaction id> (e.g., cancel 1_1)\n");
printf("\tTo cancel all CFDP transactions cancel all\n");
printf("\tTo report on a CFDP transaction report <transaction id> (e.g., report 1_1)\n");
printf("\tTo report on all CFDP transactions report all or r\n");
printf("\tTo display progress messages prog\n");
printf("\tTo stop displaying progress messages stop prog\n");
printf("\tTo log messages log <\"pathname\"> <log debug messages>\n" );
printf("\t (e.g., log \"./log.txt\" false)\n");
printf("\tTo stop logging messages stop log\n");
printf("\tTo record statistics snapshot stat <\"pathname\">\n");
printf("\t (e.g., stat \"./statistics.csv\")\n");
printf("\tTo stop recording statistics snapshot stop stat\n");
printf("\tTo reset statistics reset stat\n");
printf("\tTo record CFDP metrics snapshot metric <\"pathname\">\n");
printf("\t (e.g., metric \"./metrics.csv\")\n");
printf("\tTo stop recording CFDP metrics snapshot stop metric\n");
printf("\tTo reset CFDP metrics reset metric\n");
printf("\tTo reconfigure the CFDP console application reconfig <\"pathname\">\n");
printf("\t (e.g., reconfig \"./cfdp_config.txt\")\n");
printf("\tTo save the CFDP console configuration save <\"pathname\">\n");
printf("\t (e.g., save \"./cfdp_config.txt\")\n");
printf("\tTo display the CFDP console configuration display config\n");
printf("\tTo display CFDP console command primitives help\n");
printf("\tTo exit application exit or quit or q\n\n");
}
static void ActionCfdp()
{
{
printf("\n");
printf("\tput put <class1,class2> <\"source_pname\"> <dest eid> <\"dest_pname\">\n");
printf("\tget get <class1,class2> <\"source_pname\"> <source_node> <\"dest_pname\">\n");
printf("\tcreate_file create_file <class1,class2> <\"source_pname\"> <dest eid>\n");
printf("\tdelete_file delete_file <class1,class2> <\"source_pname\"> <dest eid>\n");
printf("\trename_file rename_file <class1,class2> <\"source_pname\"> <dest eid> <\"dest_pname\">\n");
printf("\tappend_file append_file <class1,class2> <\"source_pname\"> <dest eid> <\"dest_pname\">\n");
printf("\treplace_file replace_file <class1,class2> <\"source_pname\"> <dest eid> <\"dest_pname\">\n");
printf("\tcreate_dir create_dir <class1,class2> <\"source_pname\"> <dest eid>\n");
printf("\tremove_dir remove_dir <class1,class2> <\"source_pname\"> <dest eid>\n");
printf("\tdeny_file deny_file <class1,class2> <\"source_pname\"> <dest eid>\n");
printf("\tdeny_dir deny_dir <class1,class2> <\"source_pname\"> <dest eid>\n");
printf("\tmessage message <class1,class2> <\"message text\"> <dest eid>\n");
printf("\tbit_rate bit_rate <class1,class2> <bits per second> <dest eid>\n");
printf("\tclose_rec_file close_rec_file <class1,class2> <\"record library name\"> <dest eid> <\"record file name\">\n");
printf("\tclose_rec_file close_rec_file <class1,class2> <\"record library name\"> <dest eid> \n");
}
{
printf("\n");
printf("\tput put <life>/<cos>/<ord>/<mode>/<criticality> <\"source_pname\"> <dest eid> <\"dest_pname\">\n");
printf("\tget get <life>/<cos>/<ord>/<mode>/<criticality> <\"source_pname\"> <source_node> <\"dest_pname\">\n");
printf("\tcreate_file create_file <life>/<cos>/<ord>/<mode>/<criticality> <\"source_pname\"> <dest eid>\n");
printf("\tdelete_file delete_file <life>/<cos>/<ord>/<mode>/<criticality> <\"source_pname\"> <dest eid>\n");
printf("\trename_file rename_file <life>/<cos>/<ord>/<mode>/<criticality> <\"source_pname\"> <dest eid> <\"dest_pname\">\n");
printf("\tappend_file append_file <life>/<cos>/<ord>/<mode>/<criticality> <\"source_pname\"> <dest eid> <\"dest_pname\">\n");
printf("\treplace_file replace_file <life>/<cos>/<ord>/<mode>/<criticality> <\"source_pname\"> <dest eid> <\"dest_pname\">\n");
printf("\tcreate_dir create_dir <life>/<cos>/<ord>/<mode>/<criticality> <\"source_pname\"> <dest eid>\n");
printf("\tremove_dir remove_dir <life>/<cos>/<ord>/<mode>/<criticality> <\"source_pname\"> <dest eid>\n");
printf("\tdeny_file deny_file <life>/<cos>/<ord>/<mode>/<criticality> <\"source_pname\"> <dest eid>\n");
printf("\tdeny_dir deny_dir <life>/<cos>/<ord>/<mode>/<criticality> <\"source_pname\"> <dest eid>\n");
printf("\tmessage message <life>/<cos>/<ord>/<mode>/<criticality> <\"message text\"> <dest eid>\n");
printf("\tclose_rec_file close_rec_file <life>/<cos>/<ord>/<mode>/<criticality> <\"record library name\"> <dest eid> <\"record file name\">\n");
printf("\tclose_rec_file close_rec_file <life>/<cos>/<ord>/<mode>/<criticality> <\"record library name\"> <dest eid> \n");
}
}
int32_t main(int32_t argc, char *argv[])
{
bool exit_flag = false;
suspend_flag = false;
char config_pathname[1024];
string primitive_str;
string name;
string path_only;
string filename_only;
string pathname;
string path_name;
uint32_t primitive_count;
size_t found;
size_t next_found;
int return_code;
char command[1024];
char *arg[11];
uint32_t arg_count;
FILE *file_ptr = NULL;
string path;
string crypt_user_passphrase = "";
strcpy (config_pathname, "toolkit_cfdp_config.txt");
if (argc == 2)
{
if (strcmp(argv[1],"") != 0)
strcpy(config_pathname,argv[1]);
}
else if (argc == 3)
{
if (strcmp(argv[1], "") != 0)
strcpy(config_pathname, argv[1]);
if (strcmp(argv[2], "") != 0)
crypt_user_passphrase = argv[2];
}
else if (argc > 3)
{
if (strcmp(argv[1], "") != 0)
strcpy(config_pathname, argv[1]);
if (strcmp(argv[2], "") != 0)
crypt_user_passphrase = argv[2];
printf("Warning Command line contains too many arguments.\n");
}
else
{
file_ptr = fopen(config_pathname,"r");
if (file_ptr != NULL)
{
fclose(file_ptr);
}
}
#ifndef _WIN32
sigset_t set;
sigemptyset(&set);
sigaddset(&set, SIGINT);
if (pthread_sigmask(SIG_BLOCK, &set, NULL) != 0)
{
printf("Error Failed to block SIGINT.\n");
}
#endif
{
{
printf("Error Failed to GetDisplayConsoleMenuFlag.\n");
}
{
printf("Error Failed to GetDisplayConsoleMenuFlag.\n");
}
{
printf("Error Failed to GetDisplayMessageMask.\n");
}
{
printf("Error Failed to RegisterCFDPDeviceData.\n");
}
#ifdef _WIN32
SetConsoleCtrlHandler( (PHANDLER_ROUTINE) CtrlHandler, TRUE );
#else
struct sigaction int_handler;
sigemptyset(&set);
sigaddset(&set, SIGINT);
if (pthread_sigmask(SIG_UNBLOCK, &set, NULL) != 0)
{
printf("Error Failed to unblock SIGINT.\n");
}
int_handler.sa_handler = SigHandler;
sigemptyset(&int_handler.sa_mask);
int_handler.sa_flags = 0;
if (sigaction(SIGINT, &int_handler, NULL) == -1)
{
printf("Error Failed to set SIGINT.\n");
}
#endif
{
HelpCfdp();
printf("Enter command primitive:\n");
}
while (!exit_flag)
{
cin.clear();
getline (cin,name);
memset(command,'\0',1024);
strcpy(command,name.c_str());
Argu(command,11,arg,&arg_count);
if (arg[0] != NULL)
{
if (strcasecmp(arg[0],"put") == 0)
{
if (arg_count < 5)
{
printf("Error The number of arguments in the primitive should be >= 5 but the current argument count is %d.\n", arg_count);
}
else
{
if (suspend_flag)
{
}
else
{
}
}
}
else if (strcasecmp(arg[0],"add") == 0)
{
if (arg_count < 5)
{
printf("Error The number of arguments in the primitive should be >= 5 but the current argument count is %d.\n", arg_count);
}
else
{
found = name.find("add");
primitive_str = name.substr(found+4);
}
}
else if (strcasecmp(arg[0],"get") == 0)
{
if (arg_count < 5)
{
printf("Error The number of arguments in the primitive should be >= 5 but the current argument count is %d.\n", arg_count);
}
else
{
if (suspend_flag)
{
}
else
{
}
}
}
else if ((strcasecmp(arg[0],"create_file") == 0) || (strcasecmp(arg[0],"delete_file") == 0) ||
(strcasecmp(arg[0],"rename_file") == 0) || (strcasecmp(arg[0],"append_file") == 0) ||
(strcasecmp(arg[0],"replace_file") == 0) || (strcasecmp(arg[0],"create_dir") == 0) ||
(strcasecmp(arg[0],"remove_dir") == 0) || (strcasecmp(arg[0],"deny_file") == 0) ||
(strcasecmp(arg[0],"deny_dir") == 0) || (strcasecmp(arg[0], "close_rec_file") == 0))
{
if (arg_count < 4)
{
printf("Error The number of arguments in the primitive should be >= 4 but the current argument count is %d.\n", arg_count);
}
else
{
if (suspend_flag)
{
}
else
{
}
}
}
else if (strcasecmp(arg[0],"message") == 0)
{
if (suspend_flag)
{
}
else
{
}
}
else if (strcasecmp(arg[0], "bit_rate") == 0)
{
if (arg_count == 4)
{
if (suspend_flag)
{
}
else
{
}
}
else
{
printf("Error The number of arguments in the primitive should be 4 but the current argument count is %d.\n", arg_count);
}
}
else if (strcasecmp(arg[0],"remove") == 0)
{
}
else if (strcasecmp(arg[0],"send") == 0)
{
if (suspend_flag)
{
}
else
{
}
}
else if (strcasecmp(arg[0],"record") == 0)
{
if (arg_count > 2)
{
if (strcasecmp(arg[1],"prim") == 0)
{
found = name.find_first_not_of(" ",sizeof("record prim"));
pathname = name.substr(found);
if ((found = pathname.find("\"")) != string::npos)
{
if ((next_found = pathname.find("\"",found + 1)) != string::npos)
{
path_name = pathname.substr(found+1,next_found-found-1);
}
else
{
printf("Error Invalid record prim primitive.\n");
}
}
else
{
printf("Error Invalid record prim primitive.\n");
}
}
else
{
printf("Error Undefined primitive.\n");
}
}
else
{
printf("Error The number of arguments in the primitive should be greater than 2 but the current argument count is %d.\n", arg_count);
}
}
else if (strcasecmp(arg[0],"process") == 0)
{
if (arg_count > 1)
{
found = name.find_first_not_of(" ",sizeof("process"));
pathname = name.substr(found);
if ((found = pathname.find("\"")) != string::npos)
{
if ((next_found = pathname.find("\"",found + 1)) != string::npos)
{
path_name = pathname.substr(found+1,next_found-found-1);
if (suspend_flag)
{
}
else
{
}
}
else
{
printf("Error Invalid process prim primitive.\n");
}
}
else
{
printf("Error Invalid process prim primitive.\n");
}
}
else
{
printf("Error The number of arguments in the primitive should be greater than 1 but the current argument count is %d.\n", arg_count);
}
}
else if (strcasecmp(arg[0],"suspend") == 0)
{
if (!suspend_flag)
{
suspend_flag = true;
}
printf("Info Suspend all CFDP transactions.\n");
}
else if (strcasecmp(arg[0],"resume") == 0)
{
if (suspend_flag)
{
suspend_flag = false;
}
printf("Info Resume all CFDP transactions.\n");
}
else if (strcasecmp(arg[0],"cancel") == 0)
{
if (arg_count == 2)
{
if (strcasecmp(arg[1],"all") == 0)
{
if (suspend_flag)
{
suspend_flag = false;
}
}
else
{
if (suspend_flag)
{
}
else
{
}
}
}
else
{
printf("Error The number of arguments in the primitive should be 2 but the current argument count is %d.\n", arg_count);
}
}
else if (strcasecmp(arg[0],"report") == 0)
{
if (arg_count == 2)
{
if (strcasecmp(arg[1],"all") == 0)
{
}
else
{
}
}
else
{
printf("Error The number of arguments in the primitive should be 2 but the current argument count is %d.\n", arg_count);
}
}
else if (strcasecmp(arg[0],"r") == 0)
{
if (arg_count == 1)
{
}
else
{
printf("Error The number of arguments in the primitive should be 1 but the current argument count is %d.\n", arg_count);
}
}
else if (strcasecmp(arg[0],"prog") == 0)
{
if (arg_count == 1)
{
}
else
{
printf("Error The number of arguments in the primitive should be 1 but the current argument count is %d.\n", arg_count);
}
}
else if (strcasecmp(arg[0],"log") == 0)
{
if (arg_count > 2)
{
if ((found = name.find("\"")) != string::npos)
{
if ((next_found = name.find("\"",found + 1)) != string::npos)
{
path_name = name.substr(found+1,next_found-found-1);
name = "log " + path_name;
found = name.find_first_not_of(" ",sizeof("log"));
next_found = name.find_last_of("/\\");
if (next_found != string::npos)
{
path_only = name.substr(found,next_found - found + 1);
found = name.find_last_of(" ");
filename_only = name.substr(next_found + 1,found - next_found - 1);
if (strcasecmp(arg[arg_count - 1],"false") == 0)
{
}
else if (strcasecmp(arg[arg_count - 1],"true") == 0)
{
}
else
{
printf("Error The last argument in the primitive should be true or false.\n");
}
}
else
{
printf("Error The path must end in / or \\.\n");
}
}
else
{
printf("Error The pathname must contain \"\".\n");
}
}
else
{
printf("Error The pathname must contain \"\".\n");
}
}
else
{
printf("Error The number of arguments in the primitive should be greater than 2 but the current argument count is %d.\n", arg_count);
}
}
else if (strcasecmp(arg[0],"stop") == 0)
{
if (arg_count == 2)
{
if (strcasecmp(arg[1],"log") == 0)
{
}
else if (strcasecmp(arg[1],"stat") == 0)
{
}
else if (strcasecmp(arg[1],"metric") == 0)
{
}
else if (strcasecmp(arg[1],"prog") == 0)
{
message_mask = message_mask & (~MSG_CAT_PROGRESS);
}
else
{
printf("Error Undefined primitive.\n");
}
}
else
{
printf("Error The number of arguments in the primitive should be 2 but the current argument count is %d.\n", arg_count);
}
}
else if (strcasecmp(arg[0],"stat") == 0)
{
if (arg_count > 1)
{
if ((found = name.find("\"")) != string::npos)
{
if ((next_found = name.find("\"",found + 1)) != string::npos)
{
path_name = name.substr(found+1,next_found-found-1);
name = "stat " + path_name;
found = name.find_first_not_of(" ",sizeof("stat"));
next_found = name.find_last_of("/\\");
if (next_found != string::npos)
{
path_only = name.substr(found,next_found - found + 1);
filename_only = name.substr(next_found + 1);
}
else
{
printf("Error The path must end in / or \\.\n");
}
}
else
{
printf("Error The pathname must contain \"\".\n");
}
}
else
{
printf("Error The pathname must contain \"\".\n");
}
}
else
{
printf("Error The number of arguments in the primitive should be greater than 1 but the current argument count is %d.\n", arg_count);
}
}
else if (strcasecmp(arg[0],"metric") == 0)
{
if (arg_count > 1)
{
if ((found = name.find("\"")) != string::npos)
{
if ((next_found = name.find("\"",found + 1)) != string::npos)
{
path_name = name.substr(found+1,next_found-found-1);
name = "metric " + path_name;
found = name.find_first_not_of(" ",sizeof("metric"));
next_found = name.find_last_of("/\\");
if (next_found != string::npos)
{
path_only = name.substr(found,next_found - found + 1);
filename_only = name.substr(next_found + 1);
}
else
{
printf("Error The path must end in / or \\.\n");
}
}
else
{
printf("Error The pathname must contain \"\".\n");
}
}
else
{
printf("Error The pathname must contain \"\".\n");
}
}
else
{
printf("Error The number of arguments in the primitive should be greater than 1 but the current argument count is %d.\n", arg_count);
}
}
else if (strcasecmp(arg[0],"reset") == 0)
{
if (arg_count == 2)
{
if (strcasecmp(arg[1],"stat") == 0)
{
}
else if (strcasecmp(arg[1],"metric") == 0)
{
}
else
{
printf("Error Undefined primitive.\n");
}
}
else
{
printf("Error The number of arguments in the primitive should be 1 but the current argument count is %d.\n", arg_count);
}
}
else if (strcasecmp(arg[0],"exit") == 0 ||
strcasecmp(arg[0],"quit") == 0 ||
strcasecmp(arg[0],"q") == 0)
{
if (arg_count == 1)
{
if (suspend_flag)
{
suspend_flag = false;
}
exit_flag = true;
message_mask = 0;
{
}
}
else
{
printf("Error The number of arguments in the primitive should be 1 but the current argument count is %d.\n", arg_count);
}
}
else if (strcasecmp(arg[0],"reconfig") == 0)
{
if (arg_count > 1)
{
found = name.find_first_not_of(" ",sizeof("reconfig"));
pathname = name.substr(found);
if ((found = pathname.find("\"")) != string::npos)
{
if ((next_found = pathname.find("\"",found + 1)) != string::npos)
{
path_name = pathname.substr(found+1,next_found-found-1);
{
{
printf("Error Failed to GetDisplayConsoleMenuFlag.\n");
}
{
printf("Error Failed to GetDisplayMessageMask.\n");
}
{
printf("Error Failed to RegisterCFDPDeviceData.\n");
}
printf("Info Successfully reconfigured CFDP console app.\n");
}
else
{
printf("Error Failed to Initilize CFDP console app.\n");
}
}
else
{
printf("Error The pathname must contain \"\".\n");
}
}
else
{
printf("Error The pathname must contain \"\".\n");
}
}
else
{
printf("Error The number of arguments in the primitive should be greater than 1 but the current argument count is %d.\n", arg_count);
}
}
else if (strcasecmp(arg[0],"save") == 0)
{
if (arg_count > 1)
{
found = name.find_first_not_of(" ",sizeof("save"));
pathname = name.substr(found);
if ((found = pathname.find("\"")) != string::npos)
{
if ((next_found = pathname.find("\"",found + 1)) != string::npos)
{
path_name = pathname.substr(found+1,next_found-found-1);
{
printf("Error Failed to save configuration in file.\n");
}
}
else
{
printf("Error The pathname must contain \"\".\n");
}
}
else
{
printf("Error The pathname must contain \"\".\n");
}
}
else
{
printf("Error The number of arguments in the primitive should be greater than 1 but the current argument count is %d.\n", arg_count);
}
}
else if (strcasecmp(arg[0],"display") == 0)
{
if (arg_count == 2)
{
if (strcasecmp(arg[1],"config") == 0)
{
char config_buffer [10000];
{
printf("\n");
printf(config_buffer);
printf("\n");
}
}
else if (strcasecmp(arg[1],"actions") == 0)
{
ActionCfdp();
}
else
{
printf("Error Undefined primitive.\n");
}
}
else
{
printf("Error The number of arguments in the primitive should be 2 but the current argument count is %d.\n", arg_count);
}
}
else if (strcasecmp(arg[0],"help") == 0)
{
printf("\n");
HelpCfdp();
}
else if (strcasecmp(arg[0],"") == 0)
{
}
else
{
printf("Error Undefined primitive.\n");
}
}
}
}
else
{
printf("Error Failed to Initilize CFDP console app with error code: %d\n", return_code);
}
return 0;
}
Enumerated types for the BP device library.
device_mode_type
Definition: bp_shared.h:19
@ DM_NATIVE_CFDP
Native CFDP device mode.
Definition: bp_shared.h:23
@ DM_ION_CFDP
ION CFDP device mode.
Definition: bp_shared.h:22
Message codes and structure definition for the Device Service library.
#define DS_PACKET_RECEIVING
26 DS message code for Packet Receiving
Definition: ds_shared.h:51
boolean_type
Boolean enumeration.
Definition: ds_shared.h:104
@ FALSE_OR_NO
False.
Definition: ds_shared.h:105
@ TRUE_OR_YES
True.
Definition: ds_shared.h:106
#define DS_PACKET_SENDING
29 DS message code for Packet Sending
Definition: ds_shared.h:54
#define DS_RESUME
10 DS message code for Resume
Definition: ds_shared.h:35
#define DS_MESSAGE
45 DS message code for Message
Definition: ds_shared.h:70
Structure of parameters needed for CFDP transaction status.
Definition: ds_shared.h:145
char destination_pathname[256]
Destination path and filename.
Definition: ds_shared.h:147
unsigned long cfdp_status
(e.g., DS_PACKET_SENDING, DS_PACKET_RECEIVING, DS_SUSPEND, DS_RESUME, DS_CANCEL, DS_SUCCESS,...
Definition: ds_shared.h:164
unsigned short percent_transferred
Bytes transferred divided by file size. Will reset with packet/PDU retransmissions.
Definition: ds_shared.h:150
char message[256]
A message received in a DTN metadata or finished PDU.
Definition: ds_shared.h:160
long long bytes_transferred
The current number of bytes transmitted or received.
Definition: ds_shared.h:151
char transaction_id[50]
The transaction ID string is a combination of the decimal dotted notation EID (NATIVE) or decimal EID...
Definition: ds_shared.h:149
long long file_size
The size of the file being transferred.
Definition: ds_shared.h:152
Structure of parameters needed for message support.
Definition: trek_toolkit_common_api_ansi_c.h:74
char message[MAX_MESSAGE_SIZE]
Message.
Definition: trek_toolkit_common_api_ansi_c.h:77
enum message_category category
Message category (e.g., MSG_CAT_ERROR, MSG_CAT_ERROR_ALERT, MSG_CAT_WARNING, MSG_CAT_WARNING_ALERT,...
Definition: trek_toolkit_common_api_ansi_c.h:76
#define SUCCESS
The function completed successfully.
Definition: trek_error.h:8