ua_architecture_functions.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. * Copyright 2018 (c) Stefan Profanter, fortiss GmbH
  6. */
  7. #ifdef UA_ARCHITECTURE_FREERTOSLWIP
  8. #include <open62541/types.h>
  9. unsigned int UA_socket_set_blocking(UA_SOCKET sockfd){
  10. int on = 0;
  11. if(lwip_ioctl(sockfd, FIONBIO, &on) < 0)
  12. return UA_STATUSCODE_BADINTERNALERROR;
  13. return UA_STATUSCODE_GOOD;
  14. }
  15. unsigned int UA_socket_set_nonblocking(UA_SOCKET sockfd){
  16. int on = 1;
  17. if(lwip_ioctl(sockfd, FIONBIO, &on) < 0)
  18. return UA_STATUSCODE_BADINTERNALERROR;
  19. return UA_STATUSCODE_GOOD;
  20. }
  21. int gethostname_lwip(char* name, size_t len){
  22. // use UA_ServerConfig_set_customHostname to set your hostname as the IP
  23. return -1;
  24. }
  25. void UA_initialize_architecture_network(void){
  26. return;
  27. }
  28. void UA_deinitialize_architecture_network(void){
  29. return;
  30. }
  31. #if UA_IPV6
  32. # if LWIP_VERSION_IS_RELEASE //lwip_if_nametoindex is not yet released
  33. unsigned int lwip_if_nametoindex(const char *ifname){
  34. return 1; //TODO: assume for now that it only has one interface
  35. }
  36. # endif //LWIP_VERSION_IS_RELEASE
  37. #endif //UA_IPV6
  38. #endif /* UA_ARCHITECTURE_FREERTOSLWIP */