Rework SOPC_Helper_URI_ParseTcpUaUri
Description
Development of the PubSub module revealed that SOPC_Helper_URI_ParseTcpUaUri
can be reworked to enhance its functionalities and maintainability.
Additionally to existing remarks:
- The usage conditions of the functions should be clarified (it seems that port must be provided, but hostname is optional, as the function returns OK when hostname is null),
- Same applies for
SOPC_Helper_URI_SplitTcpUaUri
(see #592 (closed)) + change assert conditions inSOPC_Helper_URI_SplitTcpUaUri
to mirror the decision about hostname.
Analysis
The function will be reworked to better fit current needs. The following limitations about the parse function are as follows:
- simple URI parser, does not encompass the whole RFC 3986,
- the path part is not parsed nor returned, as it is not used yet, but the code should be extensible.
Fixes
- both functions will return an
enum
of the uri type:- TcpUa matches "opc.tcp://" prefixes,
- UdpUa matches "opc.udp://" prefixes,
- EthUa matches "opc.eth://" prefixes,
- MqttUa matches "mqtts://" prefixes,
- other prefixes are invalid.
- functions should evolve toward a unified
SOPC_Helper_URI_SplitUri(const char* uri, enum SOPC_UriType *type, char** hostname, char** port);
(the name of the enum is not fixed), - calls to the current SplitUri and ParseUri shall be modified.
Edited by Pierre-Antoine BRAMERET