123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- #ifndef UA_PLUGIN_NETWORK_H_
- #define UA_PLUGIN_NETWORK_H_
- #include "ua_server.h"
- #include "ua_plugin_log.h"
- _UA_BEGIN_DECLS
- 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 recvBufferSize;
- UA_UInt32 sendBufferSize;
- UA_UInt32 maxMessageSize;
- UA_UInt32 maxChunkCount;
- } UA_ConnectionConfig;
- typedef enum {
- UA_CONNECTION_CLOSED,
- UA_CONNECTION_OPENING,
- UA_CONNECTION_ESTABLISHED
- } UA_ConnectionState;
- struct UA_Connection {
- UA_ConnectionState state;
- UA_ConnectionConfig config;
- UA_SecureChannel *channel;
- UA_SOCKET sockfd;
- UA_DateTime openingDate;
- void *handle;
- UA_ByteString incompleteChunk;
- UA_UInt64 connectCallbackID;
-
- 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_ConnectionConfig localConnectionConfig;
-
- UA_StatusCode (*start)(UA_ServerNetworkLayer *nl, const UA_String *customHostname);
-
- 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 config, UA_String endpointUrl,
- UA_UInt32 timeout, UA_Logger *logger);
- _UA_END_DECLS
- #endif
|