1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- /*##############################################################################
- HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ############################################################################## */
- #pragma warning (disable : 4786)
- //JLib
- #include "jliball.hpp"
- //SCM Interfaces
- #include "esp.hpp"
- //ESP Core
- #include "espthread.hpp"
- #include "espplugin.hpp"
- //ESP Bindings
- #include "http/platform/httpprot.hpp"
- extern "C"
- {
- esp_http_decl IEspProtocol * http_protocol_factory(const char *name, const char* type, IPropertyTree *cfg, const char *process)
- {
- if (strcmp(type, "http_protocol")==0)
- {
- return new CHttpProtocol;
- }
- else if(strcmp(type, "secure_http_protocol") == 0)
- {
- IPropertyTree *sslSettings;
- sslSettings = cfg->getPropTree(StringBuffer("Software/EspProcess[@name=\"").append(process).append("\"]").append("/EspProtocol[@name=\"").append(name).append("\"]").str());
- if(sslSettings != NULL)
- {
- return new CSecureHttpProtocol(sslSettings);
- }
- else
- {
- throw MakeStringException(-1, "can't find ssl settings in the config file");
- }
- }
- else
- {
- throw MakeStringException(-1, "Unknown protocol %s", name);
- }
- return NULL;
- }
- //#ifdef ESP_PLUGIN
- ESP_FACTORY IEspProtocol * esp_protocol_factory(const char *name, const char* type, IPropertyTree *cfg, const char *process)
- {
- return http_protocol_factory(name, type, cfg, process);
- }
- //#endif //ESP_PLUGIN
- };
|