/* **************************************************************************** * * restInit - * * FIXME P5: add vector of the accepted content-types, instead of the bool * See Issue #256 */ void restInit ( RestService* _restServiceV, IpVersion _ipVersion, const char* _bindAddress, unsigned short _port, bool _multitenant, unsigned int _connectionMemory, unsigned int _maxConnections, unsigned int _mhdThreadPoolSize, const std::string& _rushHost, unsigned short _rushPort, const char* _allowedOrigin, const char* _httpsKey, const char* _httpsCertificate, RestServeFunction _serveFunction ) { const char* key = _httpsKey; const char* cert = _httpsCertificate; port = _port; restServiceV = _restServiceV; ipVersionUsed = _ipVersion; serveFunction = (_serveFunction != NULL)? _serveFunction : serve; multitenant = _multitenant; connMemory = _connectionMemory; maxConns = _maxConnections; threadPoolSize = _mhdThreadPoolSize; rushHost = _rushHost; rushPort = _rushPort; strncpy(restAllowedOrigin, _allowedOrigin, sizeof(restAllowedOrigin)); strncpy(bindIp, LOCAL_IP_V4, MAX_LEN_IP - 1); strncpy(bindIPv6, LOCAL_IP_V6, MAX_LEN_IP - 1); if (isIPv6(std::string(_bindAddress))) { strncpy(bindIPv6, _bindAddress, MAX_LEN_IP - 1); } else { strncpy(bindIp, _bindAddress, MAX_LEN_IP - 1); } // Starting REST interface int r; if ((r = restStart(_ipVersion, key, cert)) != 0) { fprintf(stderr, "restStart: error %d\n", r); orionExitFunction(1, "restStart: error"); } }
/* **************************************************************************** * * restInit - * * FIXME P5: add vector of the accepted content-types, instead of the bool * argument _acceptTextXml that was added for iotAgent only. * See Issue #256 */ void restInit ( RestService* _restServiceV, IpVersion _ipVersion, const char* _bindAddress, unsigned short _port, bool _multitenant, const std::string& _rushHost, unsigned short _rushPort, const char* _allowedOrigin, const char* _httpsKey, const char* _httpsCertificate, RestServeFunction _serveFunction, bool _acceptTextXml ) { const char* key = _httpsKey; const char* cert = _httpsCertificate; port = _port; restServiceV = _restServiceV; ipVersionUsed = _ipVersion; serveFunction = (_serveFunction != NULL)? _serveFunction : serve; acceptTextXml = _acceptTextXml; multitenant = _multitenant; rushHost = _rushHost; rushPort = _rushPort; strncpy(restAllowedOrigin, _allowedOrigin, sizeof(restAllowedOrigin)); strncpy(bindIp, LOCAL_IP_V4, MAX_LEN_IP - 1); strncpy(bindIPv6, LOCAL_IP_V6, MAX_LEN_IP - 1); if (isIPv6(std::string(_bindAddress))) strncpy(bindIPv6, _bindAddress, MAX_LEN_IP - 1); else strncpy(bindIp, _bindAddress, MAX_LEN_IP - 1); if ((_ipVersion == IPV4) || (_ipVersion == IPDUAL)) strncpy(bindIp, bindIp, MAX_LEN_IP - 1); if ((_ipVersion == IPV6) || (_ipVersion == IPDUAL)) strncpy(bindIPv6, bindIPv6, MAX_LEN_IP - 1); // Starting REST interface int r; if ((r = restStart(_ipVersion, key, cert)) != 0) { fprintf(stderr, "restStart: error %d\n", r); orionExitFunction(1, "restStart: error"); } }