open62541 1.3.12
Open source implementation of OPC UA
Loading...
Searching...
No Matches
server_config_default.h
Go to the documentation of this file.
1/** This work is licensed under a Creative Commons CCZero 1.0 Universal License.
2 * See http://creativecommons.org/publicdomain/zero/1.0/ for more information.
3 *
4 * Copyright 2017 (c) Fraunhofer IOSB (Author: Julius Pfrommer)
5 * Copyright 2017 (c) Stefan Profanter, fortiss GmbH
6 * Copyright 2018 (c) Mark Giraud, Fraunhofer IOSB
7 * Copyright 2019 (c) Kalycito Infotech Private Limited
8 */
9
10#ifndef UA_SERVER_CONFIG_DEFAULT_H_
11#define UA_SERVER_CONFIG_DEFAULT_H_
12
13#include <open62541/server.h>
14
16
17/** Create a new server with default plugins for logging etc. used during
18 * initialization. No network layer and SecurityPolicies are set so far. */
20
21
22/** Default Connection */
23
24
25extern const
27
28
29/** Default Server Config */
30
31
32/** Creates a new server config with one endpoint and custom buffer size.
33 *
34 * The config will set the tcp network layer to the given port and adds a single
35 * endpoint with the security policy ``SecurityPolicy#None`` to the server. A
36 * server certificate may be supplied but is optional.
37 * Additionally you can define a custom buffer size for send and receive buffer.
38 *
39 * @param portNumber The port number for the tcp network layer
40 * @param certificate Optional certificate for the server endpoint. Can be
41 * ``NULL``.
42 * @param sendBufferSize The size in bytes for the network send buffer
43 * @param recvBufferSize The size in bytes for the network receive buffer
44 *
45 */
46UA_EXPORT UA_StatusCode
48 UA_UInt16 portNumber,
49 const UA_ByteString *certificate,
50 UA_UInt32 sendBufferSize,
51 UA_UInt32 recvBufferSize);
52
53/** Creates a new server config with one endpoint.
54 *
55 * The config will set the tcp network layer to the given port and adds a single
56 * endpoint with the security policy ``SecurityPolicy#None`` to the server. A
57 * server certificate may be supplied but is optional. */
58static UA_StatusCode
59UA_ServerConfig_setMinimal(UA_ServerConfig *config, UA_UInt16 portNumber,
60 const UA_ByteString *certificate) {
61 return UA_ServerConfig_setMinimalCustomBuffer(config, portNumber,
62 certificate, 0, 0);
63}
64
65#ifdef UA_ENABLE_ENCRYPTION
66
67UA_EXPORT UA_StatusCode
69 UA_UInt16 portNumber,
70 const UA_ByteString *certificate,
71 const UA_ByteString *privateKey,
72 const UA_ByteString *trustList,
73 size_t trustListSize,
74 const UA_ByteString *issuerList,
75 size_t issuerListSize,
76 const UA_ByteString *revocationList,
77 size_t revocationListSize);
78
79#endif
80
81/** Creates a server config on the default port 4840 with no server
82 * certificate. */
83static UA_StatusCode
84UA_ServerConfig_setDefault(UA_ServerConfig *config) {
85 return UA_ServerConfig_setMinimal(config, 4840, NULL);
86}
87
88/** Creates a new server config with no network layer and no endpoints.
89 *
90 * It initializes reasonable defaults for many things, but does not
91 * add any network layer, security policies and endpoints.
92 * Use the various UA_ServerConfig_addXxx functions to add them.
93 *
94 * @param conf The configuration to manipulate
95 */
96UA_EXPORT UA_StatusCode
98
99/** Adds a TCP network layer with custom buffer sizes
100 *
101 * @param conf The configuration to manipulate
102 * @param portNumber The port number for the tcp network layer
103 * @param sendBufferSize The size in bytes for the network send buffer. Pass 0
104 * to use defaults.
105 * @param recvBufferSize The size in bytes for the network receive buffer.
106 * Pass 0 to use defaults.
107 */
108UA_EXPORT UA_StatusCode
110 UA_UInt32 sendBufferSize, UA_UInt32 recvBufferSize);
111
112#ifdef UA_ENABLE_WEBSOCKET_SERVER
113/** Adds a Websocket network layer with custom buffer sizes
114 *
115 * @param conf The configuration to manipulate
116 * @param portNumber The port number for the tcp network layer
117 * @param sendBufferSize The size in bytes for the network send buffer. Pass 0
118 * to use defaults.
119 * @param recvBufferSize The size in bytes for the network receive buffer.
120 * Pass 0 to use defaults.
121 * @param certificate certificate data. Pass NULL to disable WS security
122 * @param privateKey privateKey data. Pass NULL to disable WS security
123 */
124
125UA_EXPORT UA_StatusCode
126UA_ServerConfig_addNetworkLayerWS(UA_ServerConfig *conf, UA_UInt16 portNumber,
127 UA_UInt32 sendBufferSize, UA_UInt32 recvBufferSize, const UA_ByteString* certificate, const UA_ByteString* privateKey);
128#endif
129
130/** Adds the security policy ``SecurityPolicy#None`` to the server. A
131 * server certificate may be supplied but is optional.
132 *
133 * @param config The configuration to manipulate
134 * @param certificate The optional server certificate.
135 */
136UA_EXPORT UA_StatusCode
138 const UA_ByteString *certificate);
139
140#ifdef UA_ENABLE_ENCRYPTION
141
142/** Adds the security policy ``SecurityPolicy#Basic128Rsa15`` to the server. A
143 * server certificate may be supplied but is optional.
144 *
145 * Certificate verification should be configured before calling this
146 * function. See PKI plugin.
147 *
148 * @param config The configuration to manipulate
149 * @param certificate The server certificate.
150 * @param privateKey The private key that corresponds to the certificate.
151 */
152UA_EXPORT UA_StatusCode
154 const UA_ByteString *certificate,
155 const UA_ByteString *privateKey);
156
157/** Adds the security policy ``SecurityPolicy#Basic256`` to the server. A
158 * server certificate may be supplied but is optional.
159 *
160 * Certificate verification should be configured before calling this
161 * function. See PKI plugin.
162 *
163 * @param config The configuration to manipulate
164 * @param certificate The server certificate.
165 * @param privateKey The private key that corresponds to the certificate.
166 */
167UA_EXPORT UA_StatusCode
169 const UA_ByteString *certificate,
170 const UA_ByteString *privateKey);
171
172/** Adds the security policy ``SecurityPolicy#Basic256Sha256`` to the server. A
173 * server certificate may be supplied but is optional.
174 *
175 * Certificate verification should be configured before calling this
176 * function. See PKI plugin.
177 *
178 * @param config The configuration to manipulate
179 * @param certificate The server certificate.
180 * @param privateKey The private key that corresponds to the certificate.
181 */
182UA_EXPORT UA_StatusCode
184 const UA_ByteString *certificate,
185 const UA_ByteString *privateKey);
186
187/** Adds the security policy ``SecurityPolicy#Aes128Sha256RsaOaep`` to the server. A
188 * server certificate may be supplied but is optional.
189 *
190 * Certificate verification should be configured before calling this
191 * function. See PKI plugin.
192 *
193 * @param config The configuration to manipulate
194 * @param certificate The server certificate.
195 * @param privateKey The private key that corresponds to the certificate.
196 */
197UA_EXPORT UA_StatusCode
199 const UA_ByteString *certificate,
200 const UA_ByteString *privateKey);
201
202/** Adds all supported security policies and sets up certificate
203 * validation procedures.
204 *
205 * Certificate verification should be configured before calling this
206 * function. See PKI plugin.
207 *
208 * @param config The configuration to manipulate
209 * @param certificate The server certificate.
210 * @param privateKey The private key that corresponds to the certificate.
211 * @param trustList The trustList for client certificate validation.
212 * @param trustListSize The trustList size.
213 * @param revocationList The revocationList for client certificate validation.
214 * @param revocationListSize The revocationList size.
215 */
216UA_EXPORT UA_StatusCode
218 const UA_ByteString *certificate,
219 const UA_ByteString *privateKey);
220
221#endif
222
223/** Adds an endpoint for the given security policy and mode. The security
224 * policy has to be added already. See UA_ServerConfig_addXxx functions.
225 *
226 * @param config The configuration to manipulate
227 * @param securityPolicyUri The security policy for which to add the endpoint.
228 * @param securityMode The security mode for which to add the endpoint.
229 */
230UA_EXPORT UA_StatusCode
231UA_ServerConfig_addEndpoint(UA_ServerConfig *config, const UA_String securityPolicyUri,
232 UA_MessageSecurityMode securityMode);
233
234/** Adds endpoints for all configured security policies in each mode.
235 *
236 * @param config The configuration to manipulate
237 */
238UA_EXPORT UA_StatusCode
240
242
243#endif /* UA_SERVER_CONFIG_DEFAULT_H_ */
#define _UA_BEGIN_DECLS
#undef UA_DEBUG_DUMP_PKGS
Definition config.h:89
#define _UA_END_DECLS
Definition config.h:96
UA_EXPORT UA_StatusCode UA_ServerConfig_addEndpoint(UA_ServerConfig *config, const UA_String securityPolicyUri, UA_MessageSecurityMode securityMode)
Adds an endpoint for the given security policy and mode.
UA_EXPORT UA_StatusCode UA_ServerConfig_addNetworkLayerTCP(UA_ServerConfig *conf, UA_UInt16 portNumber, UA_UInt32 sendBufferSize, UA_UInt32 recvBufferSize)
Adds a TCP network layer with custom buffer sizes.
_UA_BEGIN_DECLS UA_Server * UA_Server_new(void)
This work is licensed under a Creative Commons CCZero 1.0 Universal License.
UA_EXPORT UA_StatusCode UA_ServerConfig_setDefaultWithSecurityPolicies(UA_ServerConfig *conf, UA_UInt16 portNumber, const UA_ByteString *certificate, const UA_ByteString *privateKey, const UA_ByteString *trustList, size_t trustListSize, const UA_ByteString *issuerList, size_t issuerListSize, const UA_ByteString *revocationList, size_t revocationListSize)
const UA_ConnectionConfig UA_ConnectionConfig_default
Default Connection.
UA_EXPORT UA_StatusCode UA_ServerConfig_addSecurityPolicyBasic256Sha256(UA_ServerConfig *config, const UA_ByteString *certificate, const UA_ByteString *privateKey)
Adds the security policy SecurityPolicy#Basic256Sha256 to the server.
UA_EXPORT UA_StatusCode UA_ServerConfig_addSecurityPolicyNone(UA_ServerConfig *config, const UA_ByteString *certificate)
Adds the security policy SecurityPolicy#None to the server.
UA_EXPORT UA_StatusCode UA_ServerConfig_addAllEndpoints(UA_ServerConfig *config)
Adds endpoints for all configured security policies in each mode.
UA_EXPORT UA_StatusCode UA_ServerConfig_setBasics(UA_ServerConfig *conf)
Creates a new server config with no network layer and no endpoints.
UA_EXPORT UA_StatusCode UA_ServerConfig_addSecurityPolicyAes128Sha256RsaOaep(UA_ServerConfig *config, const UA_ByteString *certificate, const UA_ByteString *privateKey)
Adds the security policy SecurityPolicy#Aes128Sha256RsaOaep to the server.
UA_EXPORT UA_StatusCode UA_ServerConfig_setMinimalCustomBuffer(UA_ServerConfig *config, UA_UInt16 portNumber, const UA_ByteString *certificate, UA_UInt32 sendBufferSize, UA_UInt32 recvBufferSize)
Default Server Config.
UA_EXPORT UA_StatusCode UA_ServerConfig_addSecurityPolicyBasic256(UA_ServerConfig *config, const UA_ByteString *certificate, const UA_ByteString *privateKey)
Adds the security policy SecurityPolicy#Basic256 to the server.
UA_EXPORT UA_StatusCode UA_ServerConfig_addSecurityPolicyBasic128Rsa15(UA_ServerConfig *config, const UA_ByteString *certificate, const UA_ByteString *privateKey)
Adds the security policy SecurityPolicy#Basic128Rsa15 to the server.
UA_EXPORT UA_StatusCode UA_ServerConfig_addAllSecurityPolicies(UA_ServerConfig *config, const UA_ByteString *certificate, const UA_ByteString *privateKey)
Adds all supported security policies and sets up certificate validation procedures.
uint16_t UA_UInt16
Definition types.h:46
uint32_t UA_UInt32
Definition types.h:56
uint32_t UA_StatusCode
Definition types.h:77
UA_MessageSecurityMode