diff --git a/src/mms/inc_private/mms_indication.h b/src/mms/inc_private/mms_indication.h new file mode 100644 index 0000000..b1a6724 --- /dev/null +++ b/src/mms/inc_private/mms_indication.h @@ -0,0 +1,41 @@ +/* + * mms_indication.h + * + * Copyright 2015 Michael Zillgith + * + * This file is part of libIEC61850. + * + * libIEC61850 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * libIEC61850 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 General Public License + * along with libIEC61850. If not, see . + * + * See COPYING file for the complete license text. + * + * + * MMS client connection handling code for libiec61850. + * + * Handles a MMS client connection. + */ + +#ifndef MMS_INDICATION_H_ +#define MMS_INDICATION_H_ + +#define DEFAULT_MAX_SERV_OUTSTANDING_CALLING 5 +#define DEFAULT_MAX_SERV_OUTSTANDING_CALLED 5 +#define DEFAULT_DATA_STRUCTURE_NESTING_LEVEL 10 + +typedef enum +{ + MMS_ERROR, MMS_INITIATE, MMS_CONFIRMED_REQUEST, MMS_OK, MMS_CONCLUDE +} MmsIndication; + +#endif /* MMS_INDICATION_H_ */ diff --git a/src/mms/iso_mms/client/mms_client_common.c b/src/mms/iso_mms/client/mms_client_common.c index f06072e..1bc2fbd 100644 --- a/src/mms/iso_mms/client/mms_client_common.c +++ b/src/mms/iso_mms/client/mms_client_common.c @@ -20,6 +20,7 @@ * * See COPYING file for the complete license text. */ + #include #include "mms_common.h" #include "mms_client_connection.h" diff --git a/src/mms/iso_mms/client/mms_client_connection.c b/src/mms/iso_mms/client/mms_client_connection.c index 43997b8..5e7d008 100644 --- a/src/mms/iso_mms/client/mms_client_connection.c +++ b/src/mms/iso_mms/client/mms_client_connection.c @@ -565,7 +565,7 @@ parseConfirmedErrorPDU(ByteBuffer* message, uint32_t* invokeId, MmsServiceError* return bufPos; - exit_error: +exit_error: return -1; } diff --git a/src/mms/iso_mms/client/mms_client_initiate.c b/src/mms/iso_mms/client/mms_client_initiate.c index 427e14e..f78748c 100644 --- a/src/mms/iso_mms/client/mms_client_initiate.c +++ b/src/mms/iso_mms/client/mms_client_initiate.c @@ -114,47 +114,28 @@ mmsClient_parseInitiateResponse(MmsConnection self) (void**) &mmsPdu, ByteBuffer_getBuffer(self->lastResponse), ByteBuffer_getSize(self->lastResponse)); - if (rval.code != RC_OK) goto exit; + if (rval.code != RC_OK) goto exit_function; if (mmsPdu->present == MmsPdu_PR_initiateResponsePdu) { InitiateResponsePdu_t* initiateResponse = &(mmsPdu->choice.initiateResponsePdu); - if (initiateResponse->localDetailCalled != NULL) { - long maxPduSize; + if (initiateResponse->localDetailCalled != NULL) + self->parameters.maxPduSize = *(initiateResponse->localDetailCalled); - maxPduSize = *(initiateResponse->localDetailCalled); + if (initiateResponse->negotiatedDataStructureNestingLevel != NULL) + self->parameters.dataStructureNestingLevel = *(initiateResponse->negotiatedDataStructureNestingLevel);; - self->parameters.maxPduSize = maxPduSize; - } + self->parameters.maxServOutstandingCalled = initiateResponse->negotiatedMaxServOutstandingCalled; - if (initiateResponse->negotiatedDataStructureNestingLevel != NULL) { - long nestingLevel; - - nestingLevel = *(initiateResponse->negotiatedDataStructureNestingLevel); - - self->parameters.dataStructureNestingLevel = nestingLevel; - } - - long maxServerOutstandingCalled; - - maxServerOutstandingCalled = initiateResponse->negotiatedMaxServOutstandingCalled; - - self->parameters.maxServOutstandingCalled = maxServerOutstandingCalled; - - long maxServerOutstandingCalling; - - maxServerOutstandingCalling = initiateResponse->negotiatedMaxServOutstandingCalling; - - self->parameters.maxServOutstandingCalling = maxServerOutstandingCalling; + self->parameters.maxServOutstandingCalling = initiateResponse->negotiatedMaxServOutstandingCalling; result = true; } else - //TODO parse error message result = false; -exit: asn_DEF_MmsPdu.free_struct(&asn_DEF_MmsPdu, mmsPdu, 0); +exit_function: return result; }