ua_architecture_functions.c 879 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. #include "ua_types.h"
  7. unsigned int UA_socket_set_blocking(UA_SOCKET sockfd){
  8. int on = 0;
  9. if(ioctl(sockfd, FIONBIO, &on) < 0)
  10. return UA_STATUSCODE_BADINTERNALERROR;
  11. return UA_STATUSCODE_GOOD;
  12. }
  13. unsigned int UA_socket_set_nonblocking(UA_SOCKET sockfd){
  14. int on = 1;
  15. if(ioctl(sockfd, FIONBIO, &on) < 0)
  16. return UA_STATUSCODE_BADINTERNALERROR;
  17. return UA_STATUSCODE_GOOD;
  18. }
  19. void UA_initialize_architecture_network(void){
  20. return;
  21. }
  22. void UA_deinitialize_architecture_network(void){
  23. return;
  24. }
  25. int gethostname_ecos(char* name, size_t len){
  26. if(strlen(UA_ECOS_HOSTNAME) > (len))
  27. return -1;
  28. strcpy(name, UA_ECOS_HOSTNAME);
  29. return 0;
  30. }