ua_stack.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * ua_stack.h
  3. *
  4. * Created on: 04.04.2014
  5. * Author: mrt
  6. */
  7. #ifndef UA_STACK_H_
  8. #define UA_STACK_H_
  9. #include "opcua.h"
  10. #include "ua_connection.h"
  11. #include "ua_list.h"
  12. #include <pthread.h> // pthreadcreate, pthread_t
  13. #include <sys/select.h> // FD_ZERO, FD_SET
  14. #define UA_TL_MAXCONNECTIONS_DEFAULT 10
  15. enum UA_TRANSPORTLAYERDESCRIPTION_ENCODING_enum {
  16. UA_TL_ENCODING_BINARY = 0,
  17. UA_TL_ENCODING_XML = 1,
  18. };
  19. enum UA_TRANSPORTLAYERDESCRIPTION_CONNECTION_enum {
  20. UA_TL_CONNECTIONTYPE_TCPV4 = 0,
  21. UA_TL_CONNECTIONTYPE_TCPV6 = 1,
  22. };
  23. typedef struct T_UA_TL_Description {
  24. UA_Int32 encoding;
  25. UA_Int32 connectionType;
  26. UA_Int32 maxConnections;
  27. TL_buffer localConf;
  28. } UA_TL_Description;
  29. extern UA_TL_Description UA_TransportLayerDescriptorTcpBinary;
  30. typedef struct T_UA_TL_data {
  31. UA_TL_Description* tld;
  32. UA_String endpointUrl;
  33. int listenerHandle;
  34. pthread_t listenerThreadHandle;
  35. UA_list_List connections;
  36. UA_Int32 threaded;
  37. fd_set readerHandles;
  38. } UA_TL_data;
  39. enum UA_STACK_THREADS_enum {
  40. UA_STACK_SINGLETHREADED = 0,
  41. UA_STACK_MULTITHREADED = 1,
  42. };
  43. UA_Int32 UA_Stack_init(UA_TL_Description* tlDesc, UA_Int32 port, UA_Int32 threaded);
  44. UA_Int32 UA_Stack_msgLoop(struct timeval* tv,UA_Int32 (*timeoutCallBack)(void*),void *arg);
  45. #endif /* UA_STACK_H_ */