libIEC61850  0.8.2
Open-source IEC 61850 MMS/GOOSE server and client library
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
mms_client_connection.h
Go to the documentation of this file.
1 /*
2  * mms_client_connection.h
3  *
4  * Copyright 2013 Michael Zillgith
5  *
6  * This file is part of libIEC61850.
7  *
8  * libIEC61850 is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * libIEC61850 is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with libIEC61850. If not, see <http://www.gnu.org/licenses/>.
20  *
21  * See COPYING file for the complete license text.
22  */
23 
24 #ifndef MMS_CLIENT_CONNECTION_H_
25 #define MMS_CLIENT_CONNECTION_H_
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
36 #include "libiec61850_common_api.h"
37 
38 #include "mms_common.h"
39 #include "mms_type_spec.h"
40 #include "mms_value.h"
42 #include "linked_list.h"
43 
47 typedef struct sMmsConnectionParameters {
51  int maxPduSize; /* local detail */
53 
54 typedef struct {
55  char* vendorName;
56  char* modelName;
57  char* revision;
59 
60 typedef void (*MmsInformationReportHandler) (void* parameter, char* domainName,
61  char* variableListName, MmsValue* value, bool isVariableListName);
62 
66 typedef struct sMmsConnection* MmsConnection;
67 
68 
69 /*******************************************************************************
70  * Connection management functions
71  *******************************************************************************/
72 
78 MmsConnection
80 
87 void
88 MmsConnection_setRequestTimeout(MmsConnection self, uint32_t timeoutInMs);
89 
96 void
97 MmsConnection_setConnectTimeout(MmsConnection self, uint32_t timeoutInMs);
98 
110 void
112  void* parameter);
113 
120 IsoConnectionParameters
121 MmsConnection_getIsoConnectionParameters(MmsConnection self);
122 
129 typedef void (*MmsConnectionLostHandler) (MmsConnection connection, void* parameter);
130 
137 void
138 MmsConnection_setConnectionLostHandler(MmsConnection self, MmsConnectionLostHandler handler, void* handlerParameter);
139 
146 void
147 MmsConnection_setIsoConnectionParameters(MmsConnection self, IsoConnectionParameters* params);
148 
154 void
155 MmsConnection_destroy(MmsConnection self);
156 
157 /*******************************************************************************
158  * Blocking functions for connection establishment and data access
159  *******************************************************************************/
160 
161 
174 bool
175 MmsConnection_connect(MmsConnection self, MmsError* mmsError, const char* serverName, int serverPort);
176 
185 void
186 MmsConnection_close(MmsConnection self);
187 
199 void
200 MmsConnection_abort(MmsConnection self, MmsError* mmsError);
201 
213 void
214 MmsConnection_conclude(MmsConnection self, MmsError* mmsError);
215 
216 
227 LinkedList /* <char*> */
228 MmsConnection_getVMDVariableNames(MmsConnection self, MmsError* mmsError);
229 
241 LinkedList /* <char*> */
242 MmsConnection_getDomainNames(MmsConnection self, MmsError* mmsError);
243 
255 LinkedList /* <char*> */
256 MmsConnection_getDomainVariableNames(MmsConnection self, MmsError* mmsError, const char* domainId);
257 
269 LinkedList /* <char*> */
270 MmsConnection_getDomainVariableListNames(MmsConnection self, MmsError* mmsError, const char* domainId);
271 
282 LinkedList /* <char*> */
283 MmsConnection_getVariableListNamesAssociationSpecific(MmsConnection self, MmsError* mmsError);
284 
285 
297 MmsValue*
298 MmsConnection_readVariable(MmsConnection self, MmsError* mmsError, const char* domainId, const char* itemId);
299 
314 MmsValue*
315 MmsConnection_readArrayElements(MmsConnection self, MmsError* mmsError, const char* domainId, const char* itemId,
316  uint32_t startIndex, uint32_t numberOfElements);
317 
330 MmsValue*
331 MmsConnection_readMultipleVariables(MmsConnection self, MmsError* mmsError, const char* domainId,
332  LinkedList /*<char*>*/ items);
333 
343 void
344 MmsConnection_writeVariable(MmsConnection self, MmsError* mmsError,
345  const char* domainId, const char* itemId, MmsValue* value);
346 
364 void
365 MmsConnection_writeMultipleVariables(MmsConnection self, MmsError* mmsError, const char* domainId,
366  LinkedList /*<char*>*/ items, LinkedList /* <MmsValue*> */ values,
367  LinkedList* /* <MmsValue*> */ accessResults);
368 
379 MmsVariableSpecification*
380 MmsConnection_getVariableAccessAttributes(MmsConnection self, MmsError* mmsError,
381  const char* domainId, const char* itemId);
382 
396 MmsValue*
397 MmsConnection_readNamedVariableListValues(MmsConnection self, MmsError* mmsError, const char* domainId,
398  const char* listName, bool specWithResult);
399 
400 
413 MmsValue*
414 MmsConnection_readNamedVariableListValuesAssociationSpecific(MmsConnection self, MmsError* mmsError,
415  const char* listName, bool specWithResult);
416 
427 void
428 MmsConnection_defineNamedVariableList(MmsConnection self, MmsError* mmsError, const char* domainId,
429  const char* listName, LinkedList variableSpecs);
430 
431 
441 void
442 MmsConnection_defineNamedVariableListAssociationSpecific(MmsConnection self, MmsError* mmsError,
443  const char* listName, LinkedList variableSpecs);
444 
457 LinkedList /* <MmsVariableAccessSpecification*> */
458 MmsConnection_readNamedVariableListDirectory(MmsConnection self, MmsError* mmsError,
459  const char* domainId, const char* listName, bool* deletable);
460 
461 
462 
472 LinkedList /* <MmsVariableAccessSpecification*> */
473 MmsConnection_readNamedVariableListDirectoryAssociationSpecific(MmsConnection self, MmsError* mmsError,
474  const char* listName, bool* deletable);
475 
484 void
485 MmsConnection_deleteNamedVariableList(MmsConnection self, MmsError* mmsError, const char* domainId, const char* listName);
486 
494 void
495 MmsConnection_deleteAssociationSpecificNamedVariableList(MmsConnection self, MmsError* mmsError,
496  const char* listName);
497 
509 MmsVariableAccessSpecification*
510 MmsVariableAccessSpecification_create(char* domainId, char* itemId);
511 
528 MmsVariableAccessSpecification*
529 MmsVariableAccessSpecification_createAlternateAccess(char* domainId, char* itemId, int32_t index,
530  char* componentName);
531 
537 void
538 MmsVariableAccessSpecification_destroy(MmsVariableAccessSpecification* self);
539 
549 void
550 MmsConnection_setLocalDetail(MmsConnection self, int32_t localDetail);
551 
552 int32_t
553 MmsConnection_getLocalDetail(MmsConnection self);
554 
565 MmsConnection_identify(MmsConnection self, MmsError* mmsError);
566 
567 void
569 
582 void
583 MmsConnection_getServerStatus(MmsConnection self, MmsError* mmsError, int* vmdLogicalStatus, int* vmdPhysicalStatus,
584  bool extendedDerivation);
585 
586 /*******************************************************************************
587  * functions for MMS file services
588  *******************************************************************************/
589 
590 typedef void
591 (*MmsFileDirectoryHandler) (void* parameter, char* filename, uint32_t size, uint64_t lastModified);
592 
593 typedef void
594 (*MmsFileReadHandler) (void* parameter, int32_t frsmId, uint8_t* buffer, uint32_t bytesReceived);
595 
601 int32_t
602 MmsConnection_fileOpen(MmsConnection self, MmsError* mmsError, const char* filename, uint32_t initialPosition,
603  uint32_t* fileSize, uint64_t* lastModified);
604 
616 bool
617 MmsConnection_fileRead(MmsConnection self, MmsError* mmsError, int32_t frsmId, MmsFileReadHandler handler, void* handlerParameter);
618 
626 void
627 MmsConnection_fileClose(MmsConnection self, MmsError* mmsError, int32_t frsmId);
628 
636 void
637 MmsConnection_fileDelete(MmsConnection self, MmsError* mmsError, const char* fileName);
638 
647 void
648 MmsConnection_fileRename(MmsConnection self, MmsError* mmsError, const char* currentFileName, const char* newFileName);
649 
666 bool
667 MmsConnection_getFileDirectory(MmsConnection self, MmsError* mmsError, const char* fileSpecification, const char* continueAfter,
668  MmsFileDirectoryHandler handler, void* handlerParameter);
669 
670 
673 #ifdef __cplusplus
674 }
675 #endif
676 
677 #endif /* MMS_CLIENT_CONNECTION_H_ */