Defined in file: hzDissemino.h
The hdsSphere (Dissemino Sphere) class is provided exclusively for Dissemino programs that host multiple webapps on behalf of multiple domains, on the same HTTP/S ports. In the current HadronZoo repertoire, only the Dissemino Web Engine (DWE) has this capability. hdsSphere is needed because Dissemino applications (webapps), are essentially limited to a single domain plus subdomains thereof. While any webapp can be shared by multiple other webapps, this is always done with specific proxy arrangements in each of the other webapps. Other than listening on non-standard ports, the shared webapp itself makes no arrangements to be shared, and will provide the exact same service to all it's clients. hdsSphere facilitates the hosting of multiple webapps by a single program, by simple dint of mapping domains to webapps. The required hostname (domain) is available in HTTP requests. By looking up the domain in the map, the HTTP requests can be routed through to the target webapp. In addition to mapping domains to webapps (and app iDs to webapps), hdsSphere holds params that are common to all webapps ascribed to it. These are:- - The HTTP/S ports - The multi-domain SSL cert if applicable. The DWE hosts each webapp in one of two ways: Internally; or by proxy. In the internal case, the hdsSphere entry for the webapp points to a hdsApp instance. In the by proxy case this pointer is NULL. hdsSphere is an optional singleton. The DWE is supplied with a single XML config file in the command arguments. This can either be that of a Dissemino Sphere with a root of <sphereCfg>, OR that of a Dissemino webapp with a root of <webappCfg>. In the latter case there is no hdsSphere instance, and the webapp in question is a singleton pointed to by _hzGlobal_Webapp. In the former case _hzGlobal_Webapp is NULL and the singleton hdsSphere instance is pointed to by _hzGlobal_Sphere.
This class employes the private sub-class _sphere_app as follows:-
_sphere_app
Constructors/Detructors
| hdsSphere* | hdsSphere | (void) | |
| hdsSphere* | hdsSphere | (hdsSphere&) | |
| Default constructor | hdsSphere() | Not specified in code. Default applies |
Public Methods:
| uint32_t | Count | (void) | |
| hdsApp* | GetApplication | (hzString& domain) | |
| hdsApp* | GetApplication | (uint32_t nPosn) | |
| hdsSphere* | GetInstance | (hzLogger& pLog) | Obtain the singleton hdsApp instance Pointer to the singleton HTML application NULL if the logger is not supplied |
| hzEcode | ReadProject | (const char* cpFilename) | |
| hzEcode | ReadSphere | (hzXmlNode* pRoot) | Read and process a Dissemino Sphere config XML document. Programs using the Dissemino method (DM) to serve HTTP/S, are invoked with a single XML config file. In the case of the DWE this must either be that of a single webapp with a <webappCfg> root tag, or that of a Dissemino Sphere (a set of one or more webapps), with a <sphereCfg> root tag. Where the program only handles a single webapp (the usual case), the config file must begin with <webappCfg> and describe a single webapp. Only the DWE requires a Dissemino Sphere and thus only the DWE calls this function. Within the <sphereCfg> tag, webapps are declared by either a <webappInternal> OR a <webappProxy> tag. In all cases the DWE will be accepting client connections on behalf of the webaps. Listening ports for the HTTP and/or HTTPS service must be specified, as must the location of any webapp specific security certificates. These parameters in the internal case, are supplied in the webapp config file. In the by proxy case, they are supplied in the <webapp> tag. Indeed, it is the presence of a listening port attribute in the <webapp> tag, that indicates that the webapp is by proxy. Note that should a multiple domain certificate apply, the files for this will be specified as attributes in the <sphereCfg> tag. Note also that webapps are usually in their own directory so where multiple webapps are to be hosted, the sphere file (containing the <sphereCfg> tag), should ideally be in none of them. |
Overloaded operators:
| hdsSphere& | operator= | (hdsSphere&) |
Member Variables:
| hzMapS<hzDomain,hdsSphere::_sphere_app*> | m_AppsByHost | Map of Dissemino Applications by Hostname | |
| hzString | m_Blacklist | Blacklist delta file | |
| hzString | m_dfltSSL_Cert | Default SSL Certificate | |
| hzString | m_dfltSSL_CertCA | Default SSL Certificate Authority | |
| hzString | m_dfltSSL_PvtKey | SSL Private key | |
| uint16_t | m_nCommonPortSSL | HTTPS Port | |
| uint16_t | m_nCommonPortSTD | HTTP Port | |
| hzLogger* | m_pLog | Logger |