123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- #ifndef UA_PLUGIN_NETWORK_H_
- #define UA_PLUGIN_NETWORK_H_
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include "ua_server.h"
- struct UA_Connection;
- typedef struct UA_Connection UA_Connection;
- struct UA_SecureChannel;
- typedef struct UA_SecureChannel UA_SecureChannel;
- struct UA_ServerNetworkLayer;
- typedef struct UA_ServerNetworkLayer UA_ServerNetworkLayer;
- typedef struct {
- UA_UInt32 protocolVersion;
- UA_UInt32 sendBufferSize;
- UA_UInt32 recvBufferSize;
- UA_UInt32 maxMessageSize;
- UA_UInt32 maxChunkCount;
- } UA_ConnectionConfig;
- typedef enum {
- UA_CONNECTION_OPENING,
- UA_CONNECTION_ESTABLISHED,
- UA_CONNECTION_CLOSED
- } UA_ConnectionState;
- struct UA_Connection {
- UA_ConnectionState state;
- UA_ConnectionConfig localConf;
- UA_ConnectionConfig remoteConf;
- UA_SecureChannel *channel;
- UA_Int32 sockfd;
- void *handle;
- UA_ByteString incompleteMessage;
-
- UA_StatusCode (*getSendBuffer)(UA_Connection *connection, size_t length,
- UA_ByteString *buf);
-
- void (*releaseSendBuffer)(UA_Connection *connection, UA_ByteString *buf);
-
- UA_StatusCode (*send)(UA_Connection *connection, UA_ByteString *buf);
-
- UA_StatusCode (*recv)(UA_Connection *connection, UA_ByteString *response,
- UA_UInt32 timeout);
-
- void (*releaseRecvBuffer)(UA_Connection *connection, UA_ByteString *buf);
-
- void (*close)(UA_Connection *connection);
-
- void (*free)(UA_Connection *connection);
- };
- void UA_EXPORT
- UA_Connection_deleteMembers(UA_Connection *connection);
- void UA_EXPORT
- UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection,
- UA_ByteString *message);
- void UA_EXPORT
- UA_Server_removeConnection(UA_Server *server, UA_Connection *connection);
- struct UA_ServerNetworkLayer {
- void *handle;
- UA_String discoveryUrl;
-
- UA_StatusCode (*start)(UA_ServerNetworkLayer *nl);
-
- UA_StatusCode (*listen)(UA_ServerNetworkLayer *nl, UA_Server *server,
- UA_UInt16 timeout);
-
- void (*stop)(UA_ServerNetworkLayer *nl, UA_Server *server);
-
- void (*deleteMembers)(UA_ServerNetworkLayer *nl);
- };
- typedef UA_Connection
- (*UA_ConnectClientConnection)(UA_ConnectionConfig localConf, const char *endpointUrl, const UA_UInt32 timeout);
- UA_StatusCode UA_EXPORT
- UA_parseEndpointUrl(const UA_String *endpointUrl, UA_String *outHostname,
- UA_UInt16 *outPort, UA_String *outPath);
- #ifdef __cplusplus
- }
- #endif
- #endif
|