ua_services_discovery.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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_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, UA_USERTOKENPOLICY);
  15. UA_UserTokenPolicy *token = response->endpoints[0]->userIdentityTokens[0];
  16. UA_String_copycstring("my-anonymous-policy", &token->policyId); // defined per server
  17. token->tokenType = UA_USERTOKENTYPE_ANONYMOUS;
  18. token->issuerEndpointUrl = (UA_String) {-1, UA_NULL};
  19. token->issuedTokenType = (UA_String) {-1, UA_NULL};
  20. token->securityPolicyUri = (UA_String) {-1, UA_NULL};
  21. UA_String_copy(&request->endpointUrl,&response->endpoints[0]->endpointUrl);
  22. UA_String_copycstring("http://open62541.info/product/release",&(response->endpoints[0]->server.productUri));
  23. // FIXME: This information should be provided by the application, preferably in the address space
  24. UA_String_copycstring("http://open62541.info/applications/4711",&(response->endpoints[0]->server.applicationUri));
  25. UA_LocalizedText_copycstring("The open62541 application",&(response->endpoints[0]->server.applicationName));
  26. // FIXME: This should be a feature of the application and an enum
  27. response->endpoints[0]->server.applicationType = UA_APPLICATIONTYPE_SERVER;
  28. // all the other strings are empty by initialization
  29. return UA_SUCCESS;
  30. }