ua_services_discovery.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include "ua_services.h"
  2. UA_Int32 Service_GetEndpoints(UA_Server *server,
  3. const UA_GetEndpointsRequest *request,
  4. UA_GetEndpointsResponse *response) {
  5. response->endpointsSize = 1;
  6. UA_Array_new((void **)&response->endpoints, response->endpointsSize,
  7. &UA_.types[UA_ENDPOINTDESCRIPTION]);
  8. //FIXME hard-coded code
  9. response->endpoints[0].securityMode = UA_MESSAGESECURITYMODE_NONE;
  10. UA_String_copycstring("http://opcfoundation.org/UA/SecurityPolicy#None",
  11. &response->endpoints[0].securityPolicyUri);
  12. UA_String_copycstring("http://opcfoundation.org/UA-Profile/Transport/uatcp-uasc-uabinary",
  13. &response->endpoints[0].transportProfileUri);
  14. response->endpoints[0].userIdentityTokensSize = 1;
  15. UA_Array_new((void **)&response->endpoints[0].userIdentityTokens,
  16. response->endpoints[0].userIdentityTokensSize,
  17. &UA_.types[UA_USERTOKENPOLICY]);
  18. UA_UserTokenPolicy *token = &response->endpoints[0].userIdentityTokens[0];
  19. UA_String_copycstring("my-anonymous-policy", &token->policyId); // defined per server
  20. token->tokenType = UA_USERTOKENTYPE_ANONYMOUS;
  21. token->issuerEndpointUrl = (UA_String ) {-1, UA_NULL };
  22. token->issuedTokenType = (UA_String ) {-1, UA_NULL };
  23. token->securityPolicyUri = (UA_String ) {-1, UA_NULL };
  24. UA_String_copy(&request->endpointUrl, &response->endpoints[0].endpointUrl);
  25. UA_String_copycstring("http://open62541.info/product/release",
  26. &(response->endpoints[0].server.productUri));
  27. // FIXME: This information should be provided by the application, preferably in the address space
  28. UA_String_copycstring("http://open62541.info/applications/4711",
  29. &(response->endpoints[0].server.applicationUri));
  30. UA_LocalizedText_copycstring("The open62541 application",
  31. &(response->endpoints[0].server.applicationName));
  32. // FIXME: This should be a feature of the application and an enum
  33. response->endpoints[0].server.applicationType = UA_APPLICATIONTYPE_SERVER;
  34. // all the other strings are empty by initialization
  35. return UA_SUCCESS;
  36. }