diff --git a/src/appHandshake/appHand_DataSerialization.c b/src/appHandshake/appHand_DataSerialization.c deleted file mode 100644 index ff76770..0000000 --- a/src/appHandshake/appHand_DataSerialization.c +++ /dev/null @@ -1,435 +0,0 @@ - -/* - * Copyright (C) 2007-2012 Siemens AG - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -/******************************************************************* - * - * @author Sebastian.Kaebisch.EXT@siemens.com - * @version 0.6 - * @contact Joerg.Heuer@siemens.com - * - *

Code generated by EXISeGen

- * - ********************************************************************/ - - -#include "appHand_service.h" -#include "appHand_dataTypes.h" - - -#include "appHand_dataTypes.h" -#include "StringTable.h" -#include "EXITypes.h" -#include "appHand_EXIEncoder.h" -#include - - - - - -static int serialize_AppProtocolType(struct AppProtocolType* type, struct EXIDatabinder* service) -{ - - /* element ID assignment of ProtocolNamespace*/ - service->eqn.namespaceURI=0; - service->eqn.localPart=2; - - - /* encode start element ProtocolNamespace */ - if (exiappHandEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn))) - { - return -1; - } - - service->val.type = EXI_DATATYPE_STRING; - service->val.string.len = type->ProtocolNamespace.arraylen.data; - memcpy(service->val.string.codepoints, type->ProtocolNamespace.data,type->ProtocolNamespace.arraylen.data*sizeof(uint32_t)); - - - /* encode character ProtocolNamespace */ - if (exiappHandEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) - { - - return -1; - } - - - /* encode end element of ProtocolNamespace */ - exiappHandEncodeEndElement(&(service->outStream), &(service->stateEncode)); - - - /* element ID assignment of VersionNumberMajor*/ - service->eqn.namespaceURI=0; - service->eqn.localPart=5; - - - /* encode start element VersionNumberMajor */ - if (exiappHandEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn))) - { - return -1; - } - - service->val.type = EXI_DATATYPE_UNSIGNED_INTEGER; - service->val.integer.val.uint32=type->VersionNumberMajor; - service->val.integer.type = EXI_UNSIGNED_INTEGER_32; - - /* encode character VersionNumberMajor */ - if (exiappHandEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) - { - - return -1; - } - - - /* encode end element of VersionNumberMajor */ - exiappHandEncodeEndElement(&(service->outStream), &(service->stateEncode)); - - - /* element ID assignment of VersionNumberMinor*/ - service->eqn.namespaceURI=0; - service->eqn.localPart=6; - - - /* encode start element VersionNumberMinor */ - if (exiappHandEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn))) - { - return -1; - } - - service->val.type = EXI_DATATYPE_UNSIGNED_INTEGER; - service->val.integer.val.uint32=type->VersionNumberMinor; - service->val.integer.type = EXI_UNSIGNED_INTEGER_32; - - /* encode character VersionNumberMinor */ - if (exiappHandEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) - { - - return -1; - } - - - /* encode end element of VersionNumberMinor */ - exiappHandEncodeEndElement(&(service->outStream), &(service->stateEncode)); - - - /* element ID assignment of SchemaID*/ - service->eqn.namespaceURI=0; - service->eqn.localPart=4; - - - /* encode start element SchemaID */ - if (exiappHandEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn))) - { - return -1; - } - - service->val.type = EXI_DATATYPE_NBIT_UNSIGNED_INTEGER; - service->val.integer.val.uint8=type->SchemaID; - service->val.integer.type = EXI_UNSIGNED_INTEGER_8; - - /* encode character SchemaID */ - if (exiappHandEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) - { - - return -1; - } - - - /* encode end element of SchemaID */ - exiappHandEncodeEndElement(&(service->outStream), &(service->stateEncode)); - - - /* element ID assignment of Priority*/ - service->eqn.namespaceURI=0; - service->eqn.localPart=1; - - - /* encode start element Priority */ - if (exiappHandEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn))) - { - return -1; - } - - service->val.type = EXI_DATATYPE_NBIT_UNSIGNED_INTEGER; - service->val.integer.val.uint8=type->Priority; - service->val.integer.type = EXI_UNSIGNED_INTEGER_8; - - /* encode character Priority */ - if (exiappHandEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) - { - - return -1; - } - - - /* encode end element of Priority */ - exiappHandEncodeEndElement(&(service->outStream), &(service->stateEncode)); - - - - return 0; -} - - -static int serialize_AnonType_supportedAppProtocolReq(struct AnonType_supportedAppProtocolReq* type, struct EXIDatabinder* service) -{ - - size_t i_loop; - - for(i_loop=0;i_loop < type->arraylen.AppProtocol;i_loop++) - { - - /* element ID assignment of AppProtocol*/ - service->eqn.namespaceURI=0; - service->eqn.localPart=0; - - - /* encode start element AppProtocol */ - if (exiappHandEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn))) - { - return -1; - } - - /* encode children of AppProtocol */ - if(serialize_AppProtocolType(&(type->AppProtocol[i_loop]),service)) - { - return -1; - } - - - /* encode end element of AppProtocol */ - exiappHandEncodeEndElement(&(service->outStream), &(service->stateEncode)); - - } - - - return 0; -} - - -static int serialize_AnonType_supportedAppProtocolRes(struct AnonType_supportedAppProtocolRes* type, struct EXIDatabinder* service) -{ - - /* element ID assignment of ResponseCode*/ - service->eqn.namespaceURI=0; - service->eqn.localPart=3; - - - /* encode start element ResponseCode */ - if (exiappHandEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn))) - { - return -1; - } - - service->val.type = EXI_DATATYPE_ENUMERATION; - service->val.enumeration=type->ResponseCode; - - /* encode character ResponseCode */ - if (exiappHandEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) - { - - return -1; - } - - - /* encode end element of ResponseCode */ - exiappHandEncodeEndElement(&(service->outStream), &(service->stateEncode)); - - - if(type->isused.SchemaID) - { - - /* element ID assignment of SchemaID*/ - service->eqn.namespaceURI=0; - service->eqn.localPart=4; - - - /* encode start element SchemaID */ - if (exiappHandEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn))) - { - return -1; - } - - service->val.type = EXI_DATATYPE_NBIT_UNSIGNED_INTEGER; - service->val.integer.val.uint8=type->SchemaID; - service->val.integer.type = EXI_UNSIGNED_INTEGER_8; - - /* encode character SchemaID */ - if (exiappHandEncodeCharacters(&(service->outStream), &(service->stateEncode), &(service->val))) - { - - return -1; - } - - - /* encode end element of SchemaID */ - exiappHandEncodeEndElement(&(service->outStream), &(service->stateEncode)); - - } - - - return 0; -} - - -static int serialize_EXIDocumentType(struct EXIDocumentType_appHand* type, struct EXIDatabinder* service) -{ - - if(type->isused.supportedAppProtocolReq) - { - - /* element ID assignment of supportedAppProtocolReq*/ - service->eqn.namespaceURI=4; - service->eqn.localPart=6; - - - /* encode start element supportedAppProtocolReq */ - if (exiappHandEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn))) - { - return -1; - } - - /* encode children of supportedAppProtocolReq */ - if(serialize_AnonType_supportedAppProtocolReq( (type->supportedAppProtocolReq),service)) - { - return -1; - } - - - - /* encode end element of supportedAppProtocolReq */ - exiappHandEncodeEndElement(&(service->outStream), &(service->stateEncode)); - return 0; - - } - - if(type->isused.supportedAppProtocolRes) - { - - /* element ID assignment of supportedAppProtocolRes*/ - service->eqn.namespaceURI=4; - service->eqn.localPart=7; - - - /* encode start element supportedAppProtocolRes */ - if (exiappHandEncodeStartElement(&(service->outStream), &(service->stateEncode), &(service->eqn))) - { - return -1; - } - - /* encode children of supportedAppProtocolRes */ - if(serialize_AnonType_supportedAppProtocolRes( (type->supportedAppProtocolRes),service)) - { - return -1; - } - - - - /* encode end element of supportedAppProtocolRes */ - exiappHandEncodeEndElement(&(service->outStream), &(service->stateEncode)); - - } - - - return 0; -} - - - - - - - /* marshal data to EXI stream */ -static int serialize_message(struct EXIDatabinder* service) - { - - - /* encode start document */ - if (exiappHandEncodeStartDocument(&(service->outStream), &(service->stateEncode)) ) - { - - return -1; - } - - /* encode root element of null */ - if (serialize_EXIDocumentType(&(service->exiMsg), service)) - { - - return -1; - } - - - /* encode end document */ - if (exiappHandEncodeEndDocument(&(service->outStream), &(service->stateEncode))) { - - return -1; - } - - return 0; - - } - - - -int serialize_appHand(struct EXIDatabinder* service, uint8_t* outStream, uint16_t* payloadLength, struct EXIDocumentType_appHand* exiDoc) -{ - exi_name_table_runtime_t runtimeTableEncode; - uint32_t outPos; - - outPos=service->transportHeaderOffset; - - /* assign outStream data to service EXI structure */ - service->outStream.data = outStream; - service->outStream.pos = &outPos; - service->outStream.buffer=0; - service->outStream.capacity=8; - - service->exiMsg = *exiDoc; - - /* init encoder (write header, set initial state) */ - exiInitNameTableRuntime(&runtimeTableEncode); - exiappHandInitEncoder(&(service->outStream), &(service->stateEncode), runtimeTableEncode); - - if(serialize_message(service)) - return -1; - - outPos -= service->transportHeaderOffset; - *payloadLength = outPos; - - return 0; - } - -/* Initialize serializer */ -int init_appHandSerializer(struct EXIDatabinder* service, bytes_t bytes, string_ucs_t string, size_t max_outStream_size, uint16_t transportHeaderOffset) -{ - - /* init byte array */ - service->val.binary = bytes; - - /* init string array */ - service->val.string = string; - - /* init output stream */ - - service->outStream.size=max_outStream_size; - - service->transportHeaderOffset=transportHeaderOffset; - - return 0; -} - - diff --git a/src/appHandshake/appHand_dataTypes.c b/src/appHandshake/appHand_dataTypes.c deleted file mode 100644 index c7ab186..0000000 --- a/src/appHandshake/appHand_dataTypes.c +++ /dev/null @@ -1,70 +0,0 @@ - -/* - * Copyright (C) 2007-2012 Siemens AG - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -/******************************************************************* - * - * @author Sebastian.Kaebisch.EXT@siemens.com - * @version 0.6 - * @contact Joerg.Heuer@siemens.com - * - *

Code generated by EXISeGen

- * - ********************************************************************/ - - -#include "EXITypes.h" -#include "appHand_dataTypes.h" - - -static void init_protocolNamespaceType(struct protocolNamespaceType* type) -{ - type->arraylen.data=0; - -} - -static void init_AppProtocolType(struct AppProtocolType* type) -{ - init_protocolNamespaceType(&(type->ProtocolNamespace)); - -} - -void init_AnonType_supportedAppProtocolReq(struct AnonType_supportedAppProtocolReq* type) -{ - int i_loop; - - for(i_loop=0; i_loop<20;i_loop++) - { - init_AppProtocolType(&(type->AppProtocol[i_loop])); - } - - type->arraylen.AppProtocol=0; - -} - - void init_AnonType_supportedAppProtocolRes(struct AnonType_supportedAppProtocolRes* type) -{ - type->isused.SchemaID=0; - -} - -void init_EXIDocumentType_appHand(struct EXIDocumentType_appHand* type) -{ - type->isused.supportedAppProtocolReq=0; - type->isused.supportedAppProtocolRes=0; - -} diff --git a/src/appHandshake/appHand_dataTypes.h b/src/appHandshake/appHand_dataTypes.h deleted file mode 100644 index 144ed97..0000000 --- a/src/appHandshake/appHand_dataTypes.h +++ /dev/null @@ -1,132 +0,0 @@ - -/* - * Copyright (C) 2007-2012 Siemens AG - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -/******************************************************************* - * - * @author Sebastian.Kaebisch.EXT@siemens.com - * @version 0.6 - * @contact Joerg.Heuer@siemens.com - * - *

Code generated by EXISeGen

- * - ********************************************************************/ - - - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef APPHANDDATATYPES_H -#define APPHANDDATATYPES_H - -#include "EXITypes.h" - - - - -enum responseCodeType_appHand -{ - OK_SuccessfulNegotiation_responseCodeType, - OK_SuccessfulNegotiationWithMinorDeviation_responseCodeType, - Failed_NoNegotiation_responseCodeType - -}; - - - - -struct arraylen_protocolNamespaceType -{ - size_t data; - - -}; - -struct protocolNamespaceType -{ - uint32_t data[100]; - struct arraylen_protocolNamespaceType arraylen; - -}; - -struct AppProtocolType -{ - struct protocolNamespaceType ProtocolNamespace; - uint32_t VersionNumberMajor; - uint32_t VersionNumberMinor; - uint8_t SchemaID; - uint8_t Priority; - - -}; - -struct arraylen_AnonType_supportedAppProtocolReq -{ - size_t AppProtocol; - - -}; - -struct AnonType_supportedAppProtocolReq -{ - struct AppProtocolType AppProtocol[20]; - struct arraylen_AnonType_supportedAppProtocolReq arraylen; - -}; - -struct selection_EXIDocumentType -{ - unsigned int supportedAppProtocolReq:1; - unsigned int supportedAppProtocolRes:1; - - -}; - -struct selection_AnonType_supportedAppProtocolRes -{ - unsigned int SchemaID:1; - - -}; - -struct AnonType_supportedAppProtocolRes -{ - enum responseCodeType_appHand ResponseCode; - uint8_t SchemaID; - struct selection_AnonType_supportedAppProtocolRes isused; - -}; - -struct EXIDocumentType_appHand -{ - struct AnonType_supportedAppProtocolReq* supportedAppProtocolReq; - struct AnonType_supportedAppProtocolRes* supportedAppProtocolRes; - struct selection_EXIDocumentType isused; - -}; - -void init_EXIDocumentType_appHand(struct EXIDocumentType_appHand* type); - -void init_AnonType_supportedAppProtocolReq(struct AnonType_supportedAppProtocolReq* type); - -#endif - -#ifdef __cplusplus -} -#endif diff --git a/src/appHandshake/appHand_service.h b/src/appHandshake/appHand_service.h deleted file mode 100644 index f5439bd..0000000 --- a/src/appHandshake/appHand_service.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2007-2010 Siemens AG - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -/******************************************************************* - * - * @author Sebastian.Kaebisch.EXT@siemens.com - * @version 0.6 - * @contact Joerg.Heuer@siemens.com - * - ********************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef EXI_DATABINDER_H_ -#define EXI_DATABINDER_H_ - -#include "appHand_dataTypes.h" - -struct uniqueIDPath2 -{ - int id[10]; - size_t pos; -}; - - -struct EXIDatabinder -{ - /* in-/ out-stream */ - bitstream_t inStream; - bitstream_t outStream; - - /* EXI */ - exi_state_t stateDecode; - exi_state_t stateEncode; - exi_event_t event; - eqname_t eqn; - exi_value_t val; - - /* main message data structure */ - struct EXIDocumentType_appHand exiMsg; - - /* unique id for ambiguous elements */ - struct uniqueIDPath2 idPath; - - uint16_t transportHeaderOffset; - - /* error code */ - uint8_t errorCode; -}; - -int serialize_appHand(struct EXIDatabinder* service, uint8_t* outStream, uint16_t* outPos, struct EXIDocumentType_appHand* exiDoc); -int deserialize_appHand(struct EXIDatabinder* service, uint8_t* inStream, uint16_t sizeInStream, struct EXIDocumentType_appHand* exiDoc); -int init_appHandSerializer(struct EXIDatabinder* service, bytes_t bytes, string_ucs_t string, size_t max_outStream_size, uint16_t transportHeaderOffset); -int init_appHandDeserializer(struct EXIDatabinder* service, bytes_t bytes, string_ucs_t string, uint16_t transportHeaderOffset); - - - -/* define error codes (TODO: define precise error codes) */ -#define EXI_NON_VALID_MESSAGE 0x01 -#define EXI_SERIALIZATION_FAILED 0x02 - -#define EXI_UNKNOWN_ERROR 0xFF - -#endif /* EXI_DATABINDER_H_ */ - -#ifdef __cplusplus -} -#endif