ua_services_discovery.c 2.1 KB

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