/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ File: OCTVC1_MAIN_API.h Copyright (c) 2018 Octasic Inc. All rights reserved. Description: Contains the definition of the MAIN API. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Release: OCTSDR Software Development Kit OCTSDR_GSM-02.11.00-B1927 (2018/04/27) $Revision: $ \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ #ifndef __OCTVC1_MAIN_API_H__ #define __OCTVC1_MAIN_API_H__ /***************************** INCLUDE FILES *******************************/ #include "../../octdev_types.h" #include "../../octdev_devices.h" #include "../octvc1_msg.h" #include "../octvc1_handle.h" #include "../octvc1_fifo.h" #include "../octvc1_buffer.h" #include "../octvc1_eth.h" #include "../octvc1_transport.h" #include "../octvc1_mac.h" #include "../octvc1_cursor.h" #include "../octvc1_list.h" #include "../octvc1_log.h" #include "../octvc1_process.h" #include "../octvc1_api.h" #include "../octvc1_module.h" #include "../octvc1_user_id.h" #include "../octvc1_stream.h" #include "octvc1_main_id.h" #include "octvc1_main_rc.h" /************************ COMMON DEFINITIONS *******************************/ /*------------------------------------------------------------------------------------- Target related definitions. -------------------------------------------------------------------------------------*/ #define cOCTVC1_MAIN_TARGET_MAX_INFO_BYTE_SIZE 768 /* Device info buffer size, in bytes. */ #define cOCTVC1_MAIN_USER_MAX_INFO_BYTE_SIZE 512 /* User info buffer size, in bytes. */ #define cOCTVC1_MAIN_USER_INFO_SIZE 0x80 /*------------------------------------------------------------------------------------- Application related definitions. -------------------------------------------------------------------------------------*/ #define cOCTVC1_MAIN_APPLICATION_MAX_INFO_BYTE_SIZE 1024 /* Application info buffer size, in bytes. */ #define cOCTVC1_MAIN_APPLICATION_MAX_NAME_LENGTH 31 /* Application name max length, in bytes. */ #define cOCTVC1_MAIN_APPLICATION_MAX_SHORT_NAME_LENGTH 15 /* Application short_name max length, in bytes. */ #define cOCTVC1_MAIN_APPLICATION_MAX_DESCRIPTION_LENGTH 127 /* Application description max length, in bytes. */ #define cOCTVC1_MAIN_APPLICATION_MAX_VERSION_LENGTH 31 /* Application version max length, in bytes. */ #define cOCTVC1_MAIN_APPLICATION_SYSTEM_MAX_VERSION_LENGTH 512 /* System info max length, in bytes. */ #define cOCTVC1_MAIN_APPLICATION_SYSTEM_MAX_PLATFORM_LENGTH 31 /* System platform max length, in bytes. */ /*------------------------------------------------------------------------------------- tOCTVC1_MAIN_APPLICATION_STATE_ENUM : -------------------------------------------------------------------------------------*/ #define tOCTVC1_MAIN_APPLICATION_STATE_ENUM tOCT_UINT32 #define cOCTVC1_MAIN_APPLICATION_STATE_ENUM_STOPPED 0 #define cOCTVC1_MAIN_APPLICATION_STATE_ENUM_STARTED 1 #define cOCTVC1_MAIN_APPLICATION_STATE_ENUM_BOOTED 2 #define cOCTVC1_MAIN_APPLICATION_STATE_ENUM_RESTRICTED 3 /* Some features are not available. */ /*------------------------------------------------------------------------------------- tOCTVC1_MAIN_APPLICATION_MODULE_STATE_ENUM : -------------------------------------------------------------------------------------*/ #define tOCTVC1_MAIN_APPLICATION_MODULE_STATE_ENUM tOCT_UINT32 #define cOCTVC1_MAIN_APPLICATION_MODULE_STATE_ENUM_INVALID 0 #define cOCTVC1_MAIN_APPLICATION_MODULE_STATE_ENUM_STOPPED 1 #define cOCTVC1_MAIN_APPLICATION_MODULE_STATE_ENUM_STARTED 2 #define cOCTVC1_MAIN_APPLICATION_MODULE_STATE_ENUM_ERROR 3 /*------------------------------------------------------------------------------------- tOCTVC1_MAIN_APPLICATION_MODULE_CONFIG_STATE_ENUM : -------------------------------------------------------------------------------------*/ #define tOCTVC1_MAIN_APPLICATION_MODULE_CONFIG_STATE_ENUM tOCT_UINT32 #define cOCTVC1_MAIN_APPLICATION_MODULE_CONFIG_STATE_ENUM_INVALID 0 #define cOCTVC1_MAIN_APPLICATION_MODULE_CONFIG_STATE_ENUM_DEFAULT 1 #define cOCTVC1_MAIN_APPLICATION_MODULE_CONFIG_STATE_ENUM_PARSE_OK 2 #define cOCTVC1_MAIN_APPLICATION_MODULE_CONFIG_STATE_ENUM_PARSE_ERROR 3 /*------------------------------------------------------------------------------------- tOCTVC1_MAIN_APPLICATION_MODULE_INFO Application Module information Members: ulReserved -------------------------------------------------------------------------------------*/ typedef struct { tOCT_UINT32 ulReserved; } tOCTVC1_MAIN_APPLICATION_MODULE_INFO; /*------------------------------------------------------------------------------------- tOCTVC1_MAIN_APPLICATION_MODULE_STATS API Command stats Members: ulState ulConfigState ulProcessCnt Current number of process active in this module. ulIpcLinkCnt Current number IPC Link. ulIpcLinkErrCnt Number IPC Link open with error. ulStartTotalCnt Total Count of start attempt. ulStartErrCnt Count of start with error. ulStopTotalCnt Total Count of stop attempt. ulStopErrCnt Count of stop with error. -------------------------------------------------------------------------------------*/ typedef struct { tOCTVC1_MAIN_APPLICATION_MODULE_STATE_ENUM ulState; tOCTVC1_MAIN_APPLICATION_MODULE_CONFIG_STATE_ENUM ulConfigState; tOCT_UINT32 ulProcessCnt; tOCT_UINT32 ulIpcLinkCnt; tOCT_UINT32 ulIpcLinkErrCnt; tOCT_UINT32 ulStartTotalCnt; tOCT_UINT32 ulStartErrCnt; tOCT_UINT32 ulStopTotalCnt; tOCT_UINT32 ulStopErrCnt; } tOCTVC1_MAIN_APPLICATION_MODULE_STATS; /*------------------------------------------------------------------------------------- API related definitions. -------------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------------- Heartbeat state. -------------------------------------------------------------------------------------*/ #define tOCTVC1_MAIN_HEARTBEAT_STATE_ENUM tOCT_UINT32 #define cOCTVC1_MAIN_HEARTBEAT_STATE_ENUM_STOP 0 #define cOCTVC1_MAIN_HEARTBEAT_STATE_ENUM_START 1 /*------------------------------------------------------------------------------------- tOCTVC1_MAIN_API_SESSION_HEARTBEAT_CONFIG Members: ulWaitTimeMs Range: [500..10000] Default: 1000 Wait time between heartbeats ulIdleOnlyFlag Default: cOCT_TRUE If true, heartbeat sent only when API session is idle -------------------------------------------------------------------------------------*/ typedef struct { tOCT_UINT32 ulWaitTimeMs; tOCT_BOOL32 ulIdleOnlyFlag; } tOCTVC1_MAIN_API_SESSION_HEARTBEAT_CONFIG; /*------------------------------------------------------------------------------------- tOCTVC1_MAIN_API_SESSION_HEARTBEAT_STATS Members: ulState ulHeartbeatSentCnt Number of heartbeats that were sent -------------------------------------------------------------------------------------*/ typedef struct { tOCTVC1_MAIN_HEARTBEAT_STATE_ENUM ulState; tOCT_UINT32 ulHeartbeatSentCnt; } tOCTVC1_MAIN_API_SESSION_HEARTBEAT_STATS; /*------------------------------------------------------------------------------------- FILE SYSTEM related definitons. -------------------------------------------------------------------------------------*/ #define cOCTVC1_MAIN_FILE_SYSTEM_NAME_MAX_LENGTH cOCTVC1_HANDLE_OBJECT32_NAME_MAX_LENGTH /* File System Name string length restriction. */ #define cOCTVC1_MAIN_FILE_SYSTEM_HOST_ROOT_PATH_MAX_LENGTH 255 /* File System Host Root path name string length restriction. */ /*------------------------------------------------------------------------------------- tOCTVC1_MAIN_FILE_SYSTEM_OPEN_PARMS Members: szName Filesystem name. Must be unique. szHostRootPathName Host root path name. -------------------------------------------------------------------------------------*/ typedef struct { tOCT_INT8 szName[(cOCTVC1_MAIN_FILE_SYSTEM_NAME_MAX_LENGTH+1)];/* NOSWAPMAC */ tOCT_INT8 szHostRootPathName[(cOCTVC1_MAIN_FILE_SYSTEM_HOST_ROOT_PATH_MAX_LENGTH+1)];/* NOSWAPMAC */ } tOCTVC1_MAIN_FILE_SYSTEM_OPEN_PARMS; /*------------------------------------------------------------------------------------- tOCTVC1_MAIN_FILE_SYSTEM_INFO_PARMS Members: hFileSystem szName Filesystem name. szHostRootPathName Host root path name. ulFileCnt NOTE: this the number of files added in this file system. FileServerAddress File server address. -------------------------------------------------------------------------------------*/ typedef struct { tOCTVC1_HANDLE_OBJECT hFileSystem; tOCT_INT8 szName[(cOCTVC1_MAIN_FILE_SYSTEM_NAME_MAX_LENGTH+1)];/* NOSWAPMAC */ tOCT_INT8 szHostRootPathName[(cOCTVC1_MAIN_FILE_SYSTEM_HOST_ROOT_PATH_MAX_LENGTH+1)];/* NOSWAPMAC */ tOCT_UINT32 ulFileCnt; tOCTVC1_TRANSPORT_ADDRESS FileServerAddress; } tOCTVC1_MAIN_FILE_SYSTEM_INFO_PARMS; /*------------------------------------------------------------------------------------- FILE related definitons. -------------------------------------------------------------------------------------*/ #define cOCTVC1_MAIN_FILE_MAX_DATA_BYTE_SIZE 1200 /* File commands (read/write) buffer size, in bytes. */ #define cOCTVC1_MAIN_FILE_NAME_MAX_LENGTH cOCTVC1_HANDLE_OBJECT32_NAME128_MAX_LENGTH /* File name string length restriction. */ /*------------------------------------------------------------------------------------- API command/response arguments file modes. -------------------------------------------------------------------------------------*/ #define tOCTVC1_MAIN_FILE_TRANSFER_MODE_ENUM tOCT_UINT32 #define cOCTVC1_MAIN_FILE_TRANSFER_MODE_ENUM_READ 0x1 /* Read from target */ #define cOCTVC1_MAIN_FILE_TRANSFER_MODE_ENUM_WRITE 0x2 /* Write to target */ /*------------------------------------------------------------------------------------- API command/response arguments file modes. -------------------------------------------------------------------------------------*/ #define tOCTVC1_MAIN_FILE_TRANSFER_STATUS_ENUM tOCT_UINT32 #define cOCTVC1_MAIN_FILE_TRANSFER_STATUS_ENUM_INVALID 0x00 #define cOCTVC1_MAIN_FILE_TRANSFER_STATUS_ENUM_WAIT_ACK 0x01 #define cOCTVC1_MAIN_FILE_TRANSFER_STATUS_ENUM_ACTIVE 0x02 #define cOCTVC1_MAIN_FILE_TRANSFER_STATUS_ENUM_WAIT_ACK_EOF 0x03 #define cOCTVC1_MAIN_FILE_TRANSFER_STATUS_ENUM_EOF 0x04 #define cOCTVC1_MAIN_FILE_TRANSFER_STATUS_ENUM_ACK_REPLY 0x05 #define cOCTVC1_MAIN_FILE_TRANSFER_STATUS_ENUM_ERROR 0x80 #define cOCTVC1_MAIN_FILE_TRANSFER_STATUS_ENUM_ERROR_NOT_FOUND 0x81 #define cOCTVC1_MAIN_FILE_TRANSFER_STATUS_ENUM_ERROR_ALREADY_OPEN 0x82 #define cOCTVC1_MAIN_FILE_TRANSFER_STATUS_ENUM_ERROR_NO_REQUEST_ACK 0x83 #define cOCTVC1_MAIN_FILE_TRANSFER_STATUS_ENUM_ERROR_MISSING_DATA 0x84 /*------------------------------------------------------------------------------------- File transfer mask. -------------------------------------------------------------------------------------*/ #define tOCTVC1_MAIN_FILE_TRANSFER_MASK tOCT_UINT32 #define cOCTVC1_MAIN_FILE_TRANSFER_MASK_NONE 0x00000000 #define cOCTVC1_MAIN_FILE_TRANSFER_MASK_REWIND ((tOCT_UINT32)(0x1<<0) ) /*------------------------------------------------------------------------------------- tOCTVC1_MAIN_FILE_TRANSFER_STATS Members: Mode Status Stream -------------------------------------------------------------------------------------*/ typedef struct { tOCTVC1_MAIN_FILE_TRANSFER_MODE_ENUM Mode; tOCTVC1_MAIN_FILE_TRANSFER_STATUS_ENUM Status; tOCTVC1_STREAM_STATS Stream; } tOCTVC1_MAIN_FILE_TRANSFER_STATS; /*------------------------------------------------------------------------------------- API command/response arguments file modes. Note : deprecated. Replaced by FILE_TRANSFER_MODE_ENUM Note : Opening both read and write at the same time is not supported. -------------------------------------------------------------------------------------*/ #define tOCTVC1_MAIN_FILE_OPEN_MODE_MASK tOCT_UINT32 #define cOCTVC1_MAIN_FILE_OPEN_MODE_MASK_READ 0x1 #define cOCTVC1_MAIN_FILE_OPEN_MODE_MASK_WRITE 0x2 /*------------------------------------------------------------------------------------- Stream related definitions -------------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------------- Stream state. -------------------------------------------------------------------------------------*/ #define tOCTVC1_MAIN_STREAM_STATE_ENUM tOCT_UINT32 #define cOCTVC1_MAIN_STREAM_STATE_ENUM_STOP 0 #define cOCTVC1_MAIN_STREAM_STATE_ENUM_START 1 /*------------------------------------------------------------------------------------- tOCTVC1_MAIN_STREAM_INFO Members: hLogicalObj ulState -------------------------------------------------------------------------------------*/ typedef struct { tOCTVC1_HANDLE_OBJECT hLogicalObj; tOCTVC1_MAIN_STREAM_STATE_ENUM ulState; } tOCTVC1_MAIN_STREAM_INFO; /*------------------------------------------------------------------------------------- LOG related sections. -------------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------------- Log Trace state. -------------------------------------------------------------------------------------*/ #define tOCTVC1_MAIN_LOG_TRACE_STATE_ENUM tOCT_UINT32 #define cOCTVC1_MAIN_LOG_TRACE_STATE_ENUM_STOP 0 #define cOCTVC1_MAIN_LOG_TRACE_STATE_ENUM_START 1 #define cOCTVC1_MAIN_LOG_MAX_NUM_FILES 32 /* Maximum total number of log files that can be logged to */ #define cOCTVC1_MAIN_LOG_FILE_PREFIX_MAX_LENGTH (cOCTVC1_MAIN_FILE_NAME_MAX_LENGTH-2) /* Maximum length of the prefix of the log filename */ #define cOCTVC1_MAIN_LOG_TRACE_FILTER_PROCESS_ENTRY_MAX 8 /* Max number of process entry in log trace filter */ /*------------------------------------------------------------------------------------- tOCTVC1_MAIN_LOG_TRACE_STATS Members: ulCurrentFileSize Size (in bytes) of the current log file. ulCurrentFileIndex The index number of the current log file. ulFileOverwriteCnt The number of times the log files were replaced/overwritten. ulNumFiles Number of valid log files. Number of indexes in the array. abyFileIndexes An array containing log file index numbers. This sequence indicates the order that the log files should be read in. szFileNamePrefix Array of bytes containing the prefix of log file name. The buffer name can be up to LOG_FILE_PREFIX_MAX_LENGTH characters long, excluding the terminating NULL character. -------------------------------------------------------------------------------------*/ typedef struct { tOCT_UINT32 ulCurrentFileSize; tOCT_UINT32 ulCurrentFileIndex; tOCT_UINT32 ulFileOverwriteCnt; tOCT_UINT32 ulNumFiles; tOCT_UINT8 abyFileIndexes[cOCTVC1_MAIN_LOG_MAX_NUM_FILES]; tOCT_INT8 szFileNamePrefix[cOCTVC1_MAIN_LOG_FILE_PREFIX_MAX_LENGTH]; } tOCTVC1_MAIN_LOG_TRACE_STATS; /*------------------------------------------------------------------------------------- tOCTVC1_MAIN_LOG_TRACE_INFO Members: ulMaxFileSize The maximum size (in bytes) of each file. ulMaxNumFiles Maximum number of files there can be at once. szFileNamePrefix Array of bytes containing the prefix of log file name. The buffer name can be up to LOG_FILE_PREFIX_MAX_LENGTH characters long, excluding the terminating NULL character. -------------------------------------------------------------------------------------*/ typedef struct { tOCT_UINT32 ulMaxFileSize; tOCT_UINT32 ulMaxNumFiles; tOCT_INT8 szFileNamePrefix[cOCTVC1_MAIN_LOG_FILE_PREFIX_MAX_LENGTH]; } tOCTVC1_MAIN_LOG_TRACE_INFO; /*------------------------------------------------------------------------------------- tOCTVC1_MAIN_LOG_TRACE_FILTER Members: ulTraceProcessAllFlag Default: cOCT_TRUE When set to cOCT_TRUE, the trace will be started for all process When set to cOCT_FALSE, the trace will be started only for specified process aTraceProcessUserId Default: cOCTVC1_USER_ID_PROCESS_ENUM_INVALID Process User ID to start trace. Only used, if ulTraceProcessAllFlag set to cOCT_FALSE -------------------------------------------------------------------------------------*/ typedef struct { tOCT_BOOL32 ulTraceProcessAllFlag; tOCTVC1_USER_ID_PROCESS_ENUM aTraceProcessUserId[cOCTVC1_MAIN_LOG_TRACE_FILTER_PROCESS_ENTRY_MAX]; } tOCTVC1_MAIN_LOG_TRACE_FILTER; /*------------------------------------------------------------------------------------- Main Module Data Definitions -------------------------------------------------------------------------------------*/ #define cOCTVC1_MAIN_MODULE_DATA_IPC ((0x0001)|(cOCTVC1_MODULE_ID_ENUM_MAIN<