ua_architecture_functions.c 898 B

12345678910111213141516171819202122232425262728293031323334
  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 2018 (c) Jose Cabral, fortiss GmbH
  5. */
  6. #ifdef UA_ARCHITECTURE_POSIX
  7. #include "ua_types.h"
  8. unsigned int UA_socket_set_blocking(UA_SOCKET sockfd){
  9. int opts = fcntl(sockfd, F_GETFL);
  10. if(opts < 0 || fcntl(sockfd, F_SETFL, opts & (~O_NONBLOCK)) < 0)
  11. return UA_STATUSCODE_BADINTERNALERROR;
  12. return UA_STATUSCODE_GOOD;
  13. }
  14. unsigned int UA_socket_set_nonblocking(UA_SOCKET sockfd){
  15. int opts = fcntl(sockfd, F_GETFL);
  16. if(opts < 0 || fcntl(sockfd, F_SETFL, opts | O_NONBLOCK) < 0)
  17. return UA_STATUSCODE_BADINTERNALERROR;
  18. return UA_STATUSCODE_GOOD;
  19. }
  20. void UA_initialize_architecture_network(void){
  21. return;
  22. }
  23. void UA_deinitialize_architecture_network(void){
  24. return;
  25. }
  26. #endif /* UA_ARCHITECTURE_POSIX */