ua_architecture_functions.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 IOSB
  5. */
  6. #include "ua_types.h"
  7. unsigned int UA_socket_set_blocking(UA_SOCKET sockfd){
  8. int on = 0;
  9. if(lwip_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(lwip_ioctl(sockfd, FIONBIO, &on) < 0)
  16. return UA_STATUSCODE_BADINTERNALERROR;
  17. return UA_STATUSCODE_GOOD;
  18. }
  19. int gethostname_freertos(char* name, size_t len){
  20. if(strlen(UA_FREERTOS_HOSTNAME) > (len))
  21. return -1;
  22. strcpy(name, UA_FREERTOS_HOSTNAME);
  23. return 0;
  24. }
  25. int UA_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res){
  26. if(NULL == node){
  27. const char* hostname = UA_FREERTOS_HOSTNAME;
  28. return lwip_getaddrinfo(hostname, service, hints, res);
  29. }else{
  30. return lwip_getaddrinfo(node, service, hints, res);
  31. }
  32. }
  33. void UA_initialize_architecture_network(void){
  34. return;
  35. }
  36. void UA_deinitialize_architecture_network(void){
  37. return;
  38. }