diff options
Diffstat (limited to 'service/native/framework_unified/client/NS_XMLConfigeParser/library/include')
4 files changed, 365 insertions, 0 deletions
diff --git a/service/native/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_XML.h b/service/native/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_XML.h new file mode 100755 index 0000000..4186f09 --- /dev/null +++ b/service/native/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_XML.h @@ -0,0 +1,113 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * 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. + */ + +////////////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup MY 14 Platfom Software Team +/// \brief Internal Header for ns_config_parser_XML.c +/// +/// These functions are used to read from and write to XML file. +/// +/// +////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_XML_H_ +#define FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_XML_H_ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include <ns_config_parser_internal.h> +#define BUFFERSIZE 200 +#define ZERO 0 + +//////////////////////////////////////////////////////////////////////////////////////////// +/// XMLGetValue: +/// Function : get value for given key. +/// +/// \param [in] pCurrNode +/// xmlNodePtr - pCurrNode is a Pointer to node of XML tree. +/// \param [in] pNodePath +/// const char * - pNodePath is a Pointer to path of Current XML node. +/// \param [in] pUserKey +/// const char * - pUserKey is a Pointer to Key provided by user. +/// \param [in] pReturnValue +/// char * - pReturnValue is a Pointer to value to be returned corresponding to Key. +/// \param [in] pReturnState +/// int * - pReturnState is updated depending upon user provided Key\n +/// returns 0 if user passed valid key.\n +/// returns 1 if user passed invalid key.\n +/// \return status +/// void +/////////////////////////////////////////////////////////////////////////////////////////// +void XMLGetValue(xmlNodePtr pcurrnode , const char *pnodepath, const char *puserkey, char *preturnvalue, + int *preturnstate); + +//////////////////////////////////////////////////////////////////////////////////////////// +/// XMLUpdateOldValue: +/// Function : update value corresponding to given user key. +/// +/// \param [in] pCurrNode +/// xmlNodePtr - pCurrNode is a Pointer to node of XML tree. +/// \param [in] pNodePath +/// const char * - pNodePath is a Pointer to path of Current XML node. +/// \param [in] pUserKey +/// const char * - pUserKey is a Pointer to Key provided by user. +/// \param [in] pValue +/// const char * - pValue is a Pointer to the new value for attribute or text. +/// \param [in] pReturnState +/// int * - returns 0 if user passed valid key.\n +/// returns -6 if old value is not updated with new value.\n +/// \return status +/// void +/////////////////////////////////////////////////////////////////////////////////////////// +void XMLUpdateOldValue(xmlNodePtr pcurrnode , const char *pnodepath, const char *puserkey, const char *preturnvalue, + int *preturnstate); + +//////////////////////////////////////////////////////////////////////////////////////////// +/// XMLUpdateOldValueWithNewValue: +/// Function : Traverse all nodes of XML tree read value to given node,compare with old value,\n +/// if old value matched then write new value in place of old value. +/// +/// \param [in] pCurrNode +/// xmlNodePtr - pCurrNode is a Pointer to node of XML tree. +/// \param [in] pNodePath +/// const char * -pNodePath is a Pointer to path of Current XML node. +/// \param [in] pUserKey +/// const char * -pUserKey is a Pointer to Key provided by user. +/// \param [in] pOldValue +/// const char * - pOldValue is a Pointer to the old value for attribute or text of key passed. +/// \param [in] pNewValue +/// const char * -pNewValue is a Pointer to the new value for attribute or text to be assigned to the key. +/// \param [in] pReturnState +/// int * - returns 0 if user passed valid key.\n +/// returns -6 if old value is not updated with new value.\n +/// \return status +/// void +/////////////////////////////////////////////////////////////////////////////////////////// +void XMLUpdateOldValueWithNewValue(xmlNodePtr pcurrnode , const char *pnodepath, const char *puserkey, + const char *poldvalue, const char *pnewvalue, int *preturnstate); + + + +#ifdef __cplusplus +} +#endif + +#endif // FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_XML_H_ + +// EOF diff --git a/service/native/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_cfg.h b/service/native/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_cfg.h new file mode 100755 index 0000000..6dcf11a --- /dev/null +++ b/service/native/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_cfg.h @@ -0,0 +1,104 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * 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. + */ + +////////////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup MY 14 Platform Software Team +/// \brief Internal Header for ns_config_parser_cfg.c +/// +/// These functions are used to read from and write to cfg file. +/// +/// +////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_CFG_H_ +#define FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_CFG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////// +// Include Files +/////////////////////////////////////////////////////////////////////////////// +#include <ns_config_parser_internal.h> +//////////////////////////////////////////////////////////////////////////////////////////// +/// CFGGetValue: +/// Function : Traverse cfg file and read value corresponding to key. +/// +/// \param [in] filePtr +/// FILE * - filePtr is a Pointer to a file descriptor. +/// \param [in] pKey +/// const char * -pKey is a Pointer to user key. +/// \param [in] pRetValue +/// char * - pRetValue is a Pointer to value or values to be returned corresponding to user key. +/// \return status +/// int - value returned depending upon user provided Key is valid or not.\n +/// returns 1 if user passed invalid key.\n +/// returns 0 if user passed valid key.\n +/// +/////////////////////////////////////////////////////////////////////////////////////////// +int CFGGetValue(FILE *file_ptr, const char *p_key, char *p_ret_value); + +//////////////////////////////////////////////////////////////////////////////////////////// +/// CFGUpdateOldValue: +/// Function : Traverse the cfg file and update the value corresponding to given key. +/// +/// \param [in] hConfigFile +/// HANDLE - hConfigFile is a handle to given file. +/// \param [in] pKey +/// const char * - pKey is a Pointer to user key. +/// \param [in] pValue +/// const char * - pValue is a Pointer to new value corresponding to user key. +/// \return status +/// int - returns 1 if user passed invalid key.\n +/// returns 0 if user passed valid key.\n +/// returns -1 if memory allocation fail.\n +/// returns -6 if value not updated in file.\n +/// +/////////////////////////////////////////////////////////////////////////////////////////// +int CFGUpdateOldValue(HANDLE h_config_file, const char *p_key, const char *p_value); + +//////////////////////////////////////////////////////////////////////////////////////////// +/// CFGUpdateOldValueWithNewValue +/// Function : Traverse the cfg file read value to given node,compare with old value,\n +/// if old value matched then write new value in place of old value.\n +/// +/// \param [in] hConfigFile +/// HANDLE - hConfigFile is a handle to given file. +/// \param [in] pKey +/// const char * - pKey is a Pointer to user key. +/// \param [in] pOldValue +/// const char * - pOldValue is a Pointer to Old Value corresponding to user key. +/// \param [in] pNewValue +/// const char * - pNewValue is a Pointer to New Value corresponding to user key. +/// \return status +/// int - returns 1 if user passed invalid key.\n +/// returns 0 if user passed valid key.\n +/// returns -1 if memory allocation fail.\n +/// returns -6 if value not updated in file.\n +/// +/////////////////////////////////////////////////////////////////////////////////////////// + +int CFGUpdateOldValueWithNewValue(HANDLE h_config_file, const char *p_key, + const char *p_old_value, const char *p_new_value); + +#ifdef __cplusplus +extern "C" { +#endif + +#endif // FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_CFG_H_ + +// EOF diff --git a/service/native/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_internal.h b/service/native/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_internal.h new file mode 100755 index 0000000..97c9be6 --- /dev/null +++ b/service/native/framework_unified/client/NS_XMLConfigeParser/library/include/ns_config_parser_internal.h @@ -0,0 +1,60 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * 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. + */ + +////////////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup MY 14 Platform Software Team +/// \brief Internal Header for ns_config_parser_cfg.c +/// +/// These structures are file handler structure. +/// +/// +////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_INTERNAL_H_ +#define FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_INTERNAL_H_ + +#include <libxml/tree.h> +#include <ns_config_parser.h> + + +// defines enum for MODE +// in which file is opened +typedef enum MODE { + kReadMode = 0, kWriteMode, kAppend +} MODE; + +// defines enum for STATUS +typedef enum STATUS { + kSuccess = 0, kFailure +} STATUS; + +// defines enum for Filetype +// i.e .cfg or .xml or other type of file +typedef enum Filetype { + kCfg = 0, kXml, kOther +} Filetype; + +// FILE STRUCTURE +typedef struct FILESTRUCT { + char *filename; + Filetype filetype; + MODE mode; + xmlDocPtr doc; + FILE *fileptr; +} FILESTRUCT; + + +#endif // FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_CONFIG_PARSER_INTERNAL_H_ diff --git a/service/native/framework_unified/client/NS_XMLConfigeParser/library/include/ns_xmlconfig_parser_frameworkunifiedlog.h b/service/native/framework_unified/client/NS_XMLConfigeParser/library/include/ns_xmlconfig_parser_frameworkunifiedlog.h new file mode 100755 index 0000000..0587489 --- /dev/null +++ b/service/native/framework_unified/client/NS_XMLConfigeParser/library/include/ns_xmlconfig_parser_frameworkunifiedlog.h @@ -0,0 +1,88 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * 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. + */ + +/////////////////////////////////////////////////////////////////////////////////////////////////// +/// \ingroup tag_NS_ConfigParser +/// \brief +/// +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_XMLCONFIG_PARSER_FRAMEWORKUNIFIEDLOG_H_ +#define FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_XMLCONFIG_PARSER_FRAMEWORKUNIFIEDLOG_H_ + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Include Files +//////////////////////////////////////////////////////////////////////////////////////////////////// +#include <native_service/ns_logger_if.h> + +#define ZONE_INIT ZONEMASK(10) +#define ZONE_FUNC ZONEMASK(11) +#define ZONE_MEM ZONEMASK(12) +#define ZONE_13 ZONEMASK(13) +#define ZONE_14 ZONEMASK(14) +#define ZONE_15 ZONEMASK(15) +#define ZONE_16 ZONEMASK(16) +#define ZONE_17 ZONEMASK(17) +#define ZONE_18 ZONEMASK(18) +#define ZONE_19 ZONEMASK(19) +#define ZONE_20 ZONEMASK(20) +#define ZONE_21 ZONEMASK(21) +#define ZONE_22 ZONEMASK(22) +#define ZONE_23 ZONEMASK(23) +#define ZONE_24 ZONEMASK(24) +#define ZONE_25 ZONEMASK(25) +#define ZONE_26 ZONEMASK(26) +#define ZONE_27 ZONEMASK(27) +#define ZONE_28 ZONEMASK(28) +#define ZONE_INFO ZONEMASK(29) +#define ZONE_WARN ZONEMASK(30) +#define ZONE_ERR ZONEMASK(31) + +#define ZONE_TEXT_10 "Init" +#define ZONE_TEXT_11 "Function" +#define ZONE_TEXT_12 "Memory" +#define ZONE_TEXT_13 "" +#define ZONE_TEXT_14 "" +#define ZONE_TEXT_15 "" +#define ZONE_TEXT_16 "" +#define ZONE_TEXT_17 "" +#define ZONE_TEXT_18 "" +#define ZONE_TEXT_19 "" +#define ZONE_TEXT_20 "" +#define ZONE_TEXT_21 "" +#define ZONE_TEXT_22 "" +#define ZONE_TEXT_23 "" +#define ZONE_TEXT_24 "" +#define ZONE_TEXT_25 "" +#define ZONE_TEXT_26 "" +#define ZONE_TEXT_27 "" +#define ZONE_TEXT_28 "" +#define ZONE_TEXT_29 "Info" +#define ZONE_TEXT_30 "Warning" +#define ZONE_TEXT_31 "Error" + +#ifndef FRAMEWORKUNIFIEDLOGOPTIONS +#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT ) // LPRINT , LMSGQ, LSLOGGER +#endif + +#ifndef FRAMEWORKUNIFIEDLOGZONES +// #define FRAMEWORKUNIFIEDLOGZONES (ZONE_WARN|ZONE_ERR) +#define FRAMEWORKUNIFIEDLOGZONES (ZONE_INIT|ZONE_FUNC|ZONE_INFO|ZONE_WARN|ZONE_ERR|ZONE_NS_WAR|ZONE_NS_ERR) +#endif + +extern const CHAR kAppName[]; +#endif // FRAMEWORK_UNIFIED_CLIENT_NS_XMLCONFIGEPARSER_LIBRARY_INCLUDE_NS_XMLCONFIG_PARSER_FRAMEWORKUNIFIEDLOG_H_ |