TReK ANSI-C  5.3.3
All ANSI-C APIs
trek_toolkit_common_api_ansi_c.h File Reference

The commonly shared macros, structures and functions. More...

Data Structures

struct  message_struct_type
 Structure of parameters needed for message support. More...
 

Macros

#define MAX_SIZE_IN_BYTES   65536
 Maximum size of a buffer.
 
#define MAX_PACKET_SIZE_IN_BYTES   65536
 Maximum size of a packet.
 
#define MAX_SUFFIX_SIZE_IN_BYTES   256
 Maximum size of a packet suffix.
 
#define MAX_DEVICE_KEY_SIZE   256
 Maximum device key size.
 
#define MAX_PACKET_KEY_SIZE   256
 Maximum packet key size.
 
#define MAX_NAME_SIZE   128
 Maximum device name size.
 
#define MAX_PATHNAME_SIZE   256
 Maximum pathname size.
 
#define MAX_MESSAGE_SIZE   512
 Maximum message size.
 

Enumerations

enum  message_category {
  MSG_CAT_ERROR = 0x00000010 ,
  MSG_CAT_ERROR_ALERT = 0x80000010 ,
  MSG_CAT_WARNING = 0x00000008 ,
  MSG_CAT_WARNING_ALERT = 0x80000008 ,
  MSG_CAT_INFO = 0x00000004 ,
  MSG_CAT_INFO_ALERT = 0x80000004 ,
  MSG_CAT_PROGRESS = 0x00000002 ,
  MSG_CAT_DEBUG = 0x00000001
}
 Message category enumeration. More...
 

Functions

const char EXPORT_THIS_TREK_TOOLKIT_COMMON_API_FUNCTION * GetMessageCategoryAsString (enum message_category input)
 Converts an enumerated message category value into its equivalent character string. More...
 
const char EXPORT_THIS_TREK_TOOLKIT_COMMON_API_FUNCTION * GetMessageCategoryAsPaddedString (enum message_category input)
 Converts an enumerated message category value into its equivalent character string with padded spaces. More...
 
int EXPORT_THIS_TREK_TOOLKIT_COMMON_API_FUNCTION TCAACGetHomeDirectory (char *directory_buffer, int buffer_size)
 Gets the path to the users home directory. More...
 
int EXPORT_THIS_TREK_TOOLKIT_COMMON_API_FUNCTION TcaGetTrekErrorMessage (int error, char *message, int buf_size)
 Gets a message string for a TReK error code. User is required to allocate buffer for the string. Message buffer size can be up to 1024 bytes. If the message string cannot be found a generic message will be returned. More...
 

Detailed Description

The commonly shared macros, structures and functions.

Enumeration Type Documentation

◆ message_category

Message category enumeration.

Enumerator
MSG_CAT_ERROR 

Error message.

MSG_CAT_ERROR_ALERT 

Error alert message (supports error alert pop up dialog box)

MSG_CAT_WARNING 

Error warning.

MSG_CAT_WARNING_ALERT 

Warning alert message (supports warning alert pop up dialog box)

MSG_CAT_INFO 

Information message.

MSG_CAT_INFO_ALERT 

Information alert message (supports information alert pop up dialog box)

MSG_CAT_PROGRESS 

Progress message.

MSG_CAT_DEBUG 

Debug message.

Function Documentation

◆ GetMessageCategoryAsPaddedString()

const char EXPORT_THIS_TREK_TOOLKIT_COMMON_API_FUNCTION * GetMessageCategoryAsPaddedString ( enum message_category  input)

Converts an enumerated message category value into its equivalent character string with padded spaces.

Parameters
[in]inputThe enum message_category (e.g., MSG_CAT_ERROR, MSG_CAT_ERROR_ALERT, MSG_CAT_WARNING, MSG_CAT_WARNING_ALERT, MSG_CAT_INFO, MSG_CAT_INFO_ALERT, MSG_CAT_PROGRESS, MSG_CAT_DEBUG).
Returns
The message category as a padded string.

Example:

@ MSG_CAT_ERROR
Error message.
Definition: trek_toolkit_common_api_ansi_c.h:56
const char EXPORT_THIS_TREK_TOOLKIT_COMMON_API_FUNCTION * GetMessageCategoryAsPaddedString(enum message_category input)
Converts an enumerated message category value into its equivalent character string with padded spaces...
Definition: trek_toolkit_common_api_ansi_c.cpp:90
Examples
cfdp_bp_destination/main.c, cfdp_bp_filestore_example/main.c, cfdp_bp_get_example/main.c, cfdp_bp_process_primitive_file/main.c, cfdp_bp_put_example/main.c, cfdp_destination/main.c, cfdp_filestore_example/main.c, cfdp_get_example_1/main.c, cfdp_get_example_2/main.c, cfdp_process_primitive_file/main.c, cfdp_put_example_1/main.c, cfdp_put_example_2/main.c, email_dropbox_example/main.c, email_example/main.c, email_file_dropbox_example/main.c, email_file_example/main.c, texting_dropbox_example/main.c, texting_example/main.c, and trek_cfdp_console.cpp.

◆ GetMessageCategoryAsString()

const char EXPORT_THIS_TREK_TOOLKIT_COMMON_API_FUNCTION * GetMessageCategoryAsString ( enum message_category  input)

Converts an enumerated message category value into its equivalent character string.

Parameters
[in]inputThe enum message_category (e.g., MSG_CAT_ERROR, MSG_CAT_ERROR_ALERT, MSG_CAT_WARNING, MSG_CAT_WARNING_ALERT, MSG_CAT_INFO, MSG_CAT_INFO_ALERT, MSG_CAT_PROGRESS, MSG_CAT_DEBUG).
Returns
The message category as a string

Example:

const char EXPORT_THIS_TREK_TOOLKIT_COMMON_API_FUNCTION * GetMessageCategoryAsString(enum message_category input)
Converts an enumerated message category value into its equivalent character string.
Definition: trek_toolkit_common_api_ansi_c.cpp:45
Examples
network_bp_destination/main.c, network_bp_destination_encrypt_decrypt/main.c, network_bp_polling/main.c, network_bp_source/main.c, network_bp_source_encrypt_decrypt/main.c, network_encrypt_decrypt/main.c, network_multicast/main.c, network_tcp/main.c, network_udp/main.c, network_udp_polling/main.c, record_api/main.c, record_tcp/main.c, and record_udp/main.c.

◆ TCAACGetHomeDirectory()

int EXPORT_THIS_TREK_TOOLKIT_COMMON_API_FUNCTION TCAACGetHomeDirectory ( char *  directory_buffer,
int  buffer_size 
)

Gets the path to the users home directory.

Parameters
[in]buffer_sizeSize of the directory buffer.
[out]directory_bufferThe buffer that contains the directory path.
Returns
SUCCESS
FAIL

Example:

char home_path[256];
if (TCAACGetHomeDirectory(home_path,sizeof(home_path)) != SUCCESS)
{
return(FAIL);
}
#define SUCCESS
The function completed successfully.
Definition: trek_error.h:8
#define FAIL
The function failed for an unknown reason.
Definition: trek_error.h:9
int EXPORT_THIS_TREK_TOOLKIT_COMMON_API_FUNCTION TCAACGetHomeDirectory(char *directory_buffer, int buffer_size)
Gets the path to the users home directory.
Definition: trek_toolkit_common_api_ansi_c.cpp:142
Examples
cfdp_bp_destination/main.c, cfdp_bp_filestore_example/main.c, cfdp_bp_get_example/main.c, cfdp_bp_process_primitive_file/main.c, cfdp_bp_put_example/main.c, cfdp_destination/main.c, cfdp_filestore_example/main.c, cfdp_get_example_1/main.c, cfdp_get_example_2/main.c, cfdp_process_primitive_file/main.c, cfdp_put_example_1/main.c, cfdp_put_example_2/main.c, email_dropbox_example/main.c, email_example/main.c, email_file_dropbox_example/main.c, email_file_example/main.c, network_bp_destination_encrypt_decrypt/main.c, network_bp_source_encrypt_decrypt/main.c, network_encrypt_decrypt/main.c, texting_dropbox_example/main.c, and texting_example/main.c.

◆ TcaGetTrekErrorMessage()

int EXPORT_THIS_TREK_TOOLKIT_COMMON_API_FUNCTION TcaGetTrekErrorMessage ( int  error,
char *  message,
int  buf_size 
)

Gets a message string for a TReK error code. User is required to allocate buffer for the string. Message buffer size can be up to 1024 bytes. If the message string cannot be found a generic message will be returned.

Parameters
[in]errorThe error code for the requested string
[out]messageThe buffer that will contain the returned message string.
[in]buf_sizeThe number of bytes allocated for message.
Returns
SUCCESS
TCA_FILE_OPEN_ERROR
TCA_NO_ENOUGH_SPACE

Example:

char message[1024];
if( TcaGetTrekErrorMessage( 35014, message, 1024 ) ) == SUCCESS )
{
printf( "Error 35014: %s\n", message );
}
int EXPORT_THIS_TREK_TOOLKIT_COMMON_API_FUNCTION TcaGetTrekErrorMessage(int error, char *message, int buf_size)
Gets a message string for a TReK error code. User is required to allocate buffer for the string....
Definition: trek_toolkit_common_api_ansi_c.cpp:168