ua_architecture_functions.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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_FREERTOS
  7. #include "ua_types.h"
  8. unsigned int UA_socket_set_blocking(UA_SOCKET sockfd){
  9. int on = 0;
  10. if(lwip_ioctl(sockfd, FIONBIO, &on) < 0)
  11. return UA_STATUSCODE_BADINTERNALERROR;
  12. return UA_STATUSCODE_GOOD;
  13. }
  14. unsigned int UA_socket_set_nonblocking(UA_SOCKET sockfd){
  15. int on = 1;
  16. if(lwip_ioctl(sockfd, FIONBIO, &on) < 0)
  17. return UA_STATUSCODE_BADINTERNALERROR;
  18. return UA_STATUSCODE_GOOD;
  19. }
  20. int gethostname_freertos(char* name, size_t len){
  21. if(strlen(UA_FREERTOS_HOSTNAME) > (len))
  22. return -1;
  23. strcpy(name, UA_FREERTOS_HOSTNAME);
  24. return 0;
  25. }
  26. int UA_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res){
  27. if(NULL == node){
  28. return lwip_getaddrinfo(UA_FREERTOS_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. }
  39. #endif /* UA_ARCHITECTURE_FREERTOS */