libiec61850  1.2.0
iso_connection_parameters.h
Go to the documentation of this file.
1 /*
2  * iso_connection_parameters.h
3  *
4  * Copyright 2013, 2014 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 ISO_CONNECTION_PARAMETERS_H_
25 #define ISO_CONNECTION_PARAMETERS_H_
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #include "tls_api.h"
32 
42 typedef enum
43 {
46 
49 
52 
56 
57 
58 typedef struct sAcseAuthenticationParameter* AcseAuthenticationParameter;
59 
61 {
63 
64  union
65  {
66  struct
67  {
68  uint8_t* octetString;
70  } password; /* for mechanism = ACSE_AUTH_PASSWORD */
71 
72  struct
73  {
74  uint8_t* buf;
75  int length;
76  } certificate; /* for mechanism = ACSE_AUTH_CERTIFICATE or ACSE_AUTH_TLS */
77 
78  } value;
79 };
80 
81 AcseAuthenticationParameter
83 
84 void
85 AcseAuthenticationParameter_destroy(AcseAuthenticationParameter self);
86 
87 void
89 
90 void
91 AcseAuthenticationParameter_setPassword(AcseAuthenticationParameter self, char* password);
92 
93 
104 typedef bool
105 (*AcseAuthenticator)(void* parameter, AcseAuthenticationParameter authParameter, void** securityToken, IsoApplicationReference* appReference);
106 
112 typedef struct {
113  uint8_t size;
114  uint8_t value[4];
115 } TSelector;
116 
117 typedef struct {
118  uint8_t size;
119  uint8_t value[16];
120 } SSelector;
121 
123 {
124  AcseAuthenticationParameter acseAuthParameter;
125 
126 #if (CONFIG_MMS_SUPPORT_TLS == 1)
127  TLSConfiguration tlsConfiguration;
128 #endif
129 
130  const char* hostname;
131  int tcpPort;
132 
133  uint8_t remoteApTitle[10];
136  uint32_t remotePSelector;
139 
140  uint8_t localApTitle[10];
143  uint32_t localPSelector;
146 
147 };
148 
149 typedef struct sIsoConnectionParameters* IsoConnectionParameters;
150 
159 IsoConnectionParameters
161 
170 void
171 IsoConnectionParameters_destroy(IsoConnectionParameters self);
172 
173 
174 void
175 IsoConnectionParameters_setTlsConfiguration(IsoConnectionParameters self, TLSConfiguration tlsConfig);
176 
185 void
186 IsoConnectionParameters_setAcseAuthenticationParameter(IsoConnectionParameters self,
187  AcseAuthenticationParameter acseAuthParameter);
188 
199 void
200 IsoConnectionParameters_setTcpParameters(IsoConnectionParameters self, const char* hostname, int tcpPort);
201 
214 void
215 IsoConnectionParameters_setRemoteApTitle(IsoConnectionParameters self, const char* apTitle, int aeQualifier);
216 
229 void
230 IsoConnectionParameters_setRemoteAddresses(IsoConnectionParameters self, uint32_t pSelector, SSelector sSelector, TSelector tSelector);
231 
244 void
245 IsoConnectionParameters_setLocalApTitle(IsoConnectionParameters self, const char* apTitle, int aeQualifier);
246 
259 void
260 IsoConnectionParameters_setLocalAddresses(IsoConnectionParameters self, uint32_t pSelector, SSelector sSelector, TSelector tSelector);
261 
264 #ifdef __cplusplus
265 }
266 #endif
267 
268 #endif /* ISO_CONNECTION_PARAMETERS_H_ */
Definition: iso_connection_parameters.h:51
TSelector localTSelector
Definition: iso_connection_parameters.h:145
AcseAuthenticationParameter acseAuthParameter
Definition: iso_connection_parameters.h:124
uint32_t localPSelector
Definition: iso_connection_parameters.h:143
uint8_t * octetString
Definition: iso_connection_parameters.h:68
struct sAcseAuthenticationParameter::@0::@2 certificate
uint8_t size
Definition: iso_connection_parameters.h:113
void IsoConnectionParameters_setLocalAddresses(IsoConnectionParameters self, uint32_t pSelector, SSelector sSelector, TSelector tSelector)
set local addresses for the lower layers
int remoteApTitleLen
Definition: iso_connection_parameters.h:134
Definition: iso_connection_parameters.h:48
void IsoConnectionParameters_setLocalApTitle(IsoConnectionParameters self, const char *apTitle, int aeQualifier)
set the local AP-Title and AE-Qualifier
uint8_t * buf
Definition: iso_connection_parameters.h:74
AcseAuthenticationParameter AcseAuthenticationParameter_create(void)
const char * hostname
Definition: iso_connection_parameters.h:130
Definition: iso_connection_parameters.h:122
bool(* AcseAuthenticator)(void *parameter, AcseAuthenticationParameter authParameter, void **securityToken, IsoApplicationReference *appReference)
Callback function to authenticate a client.
Definition: iso_connection_parameters.h:105
int passwordLength
Definition: iso_connection_parameters.h:69
struct sAcseAuthenticationParameter::@0::@1 password
TSelector remoteTSelector
Definition: iso_connection_parameters.h:138
AcseAuthenticationMechanism mechanism
Definition: iso_connection_parameters.h:62
void AcseAuthenticationParameter_setAuthMechanism(AcseAuthenticationParameter self, AcseAuthenticationMechanism mechanism)
void IsoConnectionParameters_setTcpParameters(IsoConnectionParameters self, const char *hostname, int tcpPort)
Set TCP parameters (FOR LIBRARY INTERNAL USE)
Definition: iso_connection_parameters.h:54
Definition: iso_connection_parameters.h:60
AcseAuthenticationMechanism
authentication mechanism úsed by AcseAuthenticator
Definition: iso_connection_parameters.h:42
uint8_t size
Definition: iso_connection_parameters.h:118
void AcseAuthenticationParameter_setPassword(AcseAuthenticationParameter self, char *password)
void IsoConnectionParameters_setRemoteAddresses(IsoConnectionParameters self, uint32_t pSelector, SSelector sSelector, TSelector tSelector)
set remote addresses for the lower layers
int localApTitleLen
Definition: iso_connection_parameters.h:141
SSelector remoteSSelector
Definition: iso_connection_parameters.h:137
void IsoConnectionParameters_destroy(IsoConnectionParameters self)
Destroy an IsoConnectionParameters instance (FOR LIBRARY INTERNAL USE)
void IsoConnectionParameters_setAcseAuthenticationParameter(IsoConnectionParameters self, AcseAuthenticationParameter acseAuthParameter)
set the authentication parameter
union sAcseAuthenticationParameter::@0 value
void AcseAuthenticationParameter_destroy(AcseAuthenticationParameter self)
ISO application reference (specifies an ISO application endpoint)
Definition: mms_common.h:169
COTP T selector.
Definition: iso_connection_parameters.h:112
Definition: iso_connection_parameters.h:117
IsoConnectionParameters IsoConnectionParameters_create(void)
create a new IsoConnectionParameters instance (FOR LIBRARY INTERNAL USE)
int tcpPort
Definition: iso_connection_parameters.h:131
Definition: iso_connection_parameters.h:45
void IsoConnectionParameters_setTlsConfiguration(IsoConnectionParameters self, TLSConfiguration tlsConfig)
int localAEQualifier
Definition: iso_connection_parameters.h:142
SSelector localSSelector
Definition: iso_connection_parameters.h:144
int length
Definition: iso_connection_parameters.h:75
uint32_t remotePSelector
Definition: iso_connection_parameters.h:136
int remoteAEQualifier
Definition: iso_connection_parameters.h:135
void IsoConnectionParameters_setRemoteApTitle(IsoConnectionParameters self, const char *apTitle, int aeQualifier)
set the remote AP-Title and AE-Qualifier