#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/timeb.h>
#include <string.h>
#ifdef __linux__
#include <unistd.h>
#else
#include <windows.h>
#endif
unsigned int message_mask;
char home_path[256];
{
if (mess_struct_ptr->
category & message_mask)
{
}
}
void DeviceData(const char *device_key,
int packet_length,
unsigned char *packet_buffer_ptr)
{
unsigned int count;
for (count = 0; count*
sizeof(
cfdp_struct_type) < (
unsigned int)packet_length; count++)
{
{
printf("Progress Transaction_id %s -> %s\t file size=%lld\t bytes trans=%lld\t percent trans=%u%%\n",
}
}
}
int InitExampleDataFilesPathnames(char *pathname1MB,
char *destination_pathname1MB,
char *pathname2MB,
char *destination_pathname2MB,
char *pathname3MB,
char *destination_pathname3MB)
{
struct timeb timebuffer;
{
}
sprintf(pathname1MB, "%s/cfdp_bp_destination_data_file_1MB",home_path);
ftime(&timebuffer);
sprintf(destination_pathname1MB,"%s_%u",
pathname1MB,
(unsigned int)timebuffer.time);
sprintf(pathname2MB, "%s/cfdp_bp_destination_data_file_2MB",home_path);
sprintf(destination_pathname2MB,"%s_%u",
pathname2MB,
(unsigned int)timebuffer.time);
sprintf(pathname3MB, "%s/cfdp_bp_destination_data_file_3MB",home_path);
sprintf(destination_pathname3MB,"%s_%u",
pathname3MB,
(unsigned int)timebuffer.time);
}
int main(int argc, char *argv[])
{
int return_value;
char pathname[256];
char pathname1MB[256];
char destination_pathname1MB[256];
char pathname2MB[256];
char destination_pathname2MB[256];
char pathname3MB[256];
char destination_pathname3MB[256];
long long eid;
unsigned int transaction_count;
unsigned int timeout_in_sec;
unsigned int i;
char log_path[256];
char log_filename[256];
unsigned int lifespan;
unsigned int ordinal;
char filestore_pathname[256];
strcpy (pathname, "./cfdp_bp_filestore_example_config.txt");
if (argc == 2)
{
strcpy(pathname,argv[1]);
}
else if (argc > 2)
{
printf("Error Command line contains too many arguments.\n");
return 0;
}
strcpy(log_path,"");
strcpy(log_filename,"cfdp_bp_filestore_example_log_file");
log_filename,
{
strcpy(log_path,"");
strcpy(log_filename,"cfdp_bp_filestore_example_metrics_file");
{
printf("Error Failed to GetDisplayMessageMask.\n");
}
{
printf("Error Failed to RegisterCFDPDeviceData.\n");
}
if (InitExampleDataFilesPathnames(pathname1MB,
destination_pathname1MB,
pathname2MB,
destination_pathname2MB,
pathname3MB,
destination_pathname3MB) !=
SUCCESS)
{
printf("Error Failed to InitExampleDataFiles.\n");
return 0;
}
eid = 2;
printf("\nCFDP BP Filestore Example\n\n");
sprintf(filestore_pathname, "%s/test_create_file",home_path);
{
printf("Error Failed to create file.\n");
return 0;
}
lifespan = 86400;
ordinal = 0;
lifespan,cos,ordinal,mode,criticality) !=
SUCCESS)
{
printf("Error Failed to delete file.\n");
return 0;
}
{
printf("Error Failed to append file.\n");
return 0;
}
{
printf("Error Failed to rename file.\n");
return 0;
}
lifespan = 86400;
ordinal = 0;
cos,ordinal,mode,criticality) !=
SUCCESS)
{
printf("Error Failed to add delete file request.\n");
return 0;
}
{
printf("Error Failed to SendAllFilestoreRequests.\n");
return 0;
}
timeout_in_sec = 300;
transaction_count = 5;
&transaction_count,
&cfdp_struct_array_ptr);
{
for (i=0; i<transaction_count;i++)
{
if (cfdp_struct_array_ptr[i].cfdp_status ==
DS_SUCCESS)
{
cfdp_struct_array_ptr[i].cfdp_filestore_action,
cfdp_struct_array_ptr[i].source_pathname,
cfdp_struct_array_ptr[i].destination_pathname,
cfdp_struct_array_ptr[i].eid);
}
else
{
printf("Info Failed to execute filestore with transaction ID: %s.\n",
cfdp_struct_array_ptr[i].transaction_id);
}
}
}
else
{
printf("Error Failed to MonitorAllCFDPTransactions.\n");
}
}
#ifdef __linux__
sleep(2);
#else
Sleep(2000);
#endif
return 0;
}