summaryrefslogtreecommitdiff
path: root/libs/networking/include
diff options
context:
space:
mode:
authorgeronimo <geronimo013@gmx.de>2012-07-29 13:11:47 (GMT)
committergeronimo <geronimo013@gmx.de>2012-07-29 13:11:47 (GMT)
commit85cb3f04252b0228830903b21c08bb64e9919c18 (patch)
tree5c00dbd8d296861aa56cca598ee2a36e51971822 /libs/networking/include
parent736033f3d532c4814eeff84db5dbf99f0249df6e (diff)
downloadcmp-85cb3f04252b0228830903b21c08bb64e9919c18.tar.gz
cmp-85cb3f04252b0228830903b21c08bb64e9919c18.tar.bz2
changed server setup to config file, little rearrangement of sources
Diffstat (limited to 'libs/networking/include')
-rw-r--r--libs/networking/include/Credentials.h7
-rw-r--r--libs/networking/include/HTTPResponse.h12
-rw-r--r--libs/networking/include/ServerConfig.h38
-rw-r--r--libs/networking/include/Url.h67
4 files changed, 37 insertions, 87 deletions
diff --git a/libs/networking/include/Credentials.h b/libs/networking/include/Credentials.h
index cdc7903..44dc17c 100644
--- a/libs/networking/include/Credentials.h
+++ b/libs/networking/include/Credentials.h
@@ -26,10 +26,11 @@
#define CREDENTIALS_H
#include <Principal.h>
+#include <Persistable.h>
#include <string>
#include <tr1/unordered_map>
-class cCredentials {
+class cCredentials : public cPersistable {
public:
typedef std::tr1::unordered_map<std::string, cPrincipal *>::const_iterator const_iterator;
cCredentials();
@@ -39,8 +40,8 @@ public:
const char *ApplicationRealm(void) const;
void SetApplicationRealm(const char *ApplicationRealm = "knownUser@myApp");
- int Load(const char *FileName);
- int Store(const char *FileName);
+ virtual int Load(const char *FileName);
+ virtual int Store(const char *FileName);
void Put(const char *Key, cPrincipal *p);
cPrincipal *Get(const char *Key);
diff --git a/libs/networking/include/HTTPResponse.h b/libs/networking/include/HTTPResponse.h
index dbc0969..0bb6d72 100644
--- a/libs/networking/include/HTTPResponse.h
+++ b/libs/networking/include/HTTPResponse.h
@@ -1,25 +1,25 @@
/**
* ======================== legal notice ======================
- *
+ *
* File: HTTPResponse.h
* Created: 4. Juli 2012, 06
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libnetworking: classes for tcp/ip sockets and http-protocol handling
- *
+ *
* CMP - compound media player
- *
+ *
* is a client/server mediaplayer intended to play any media from any workstation
* without the need to export or mount shares. cmps is an easy to use backend
* with a (ready to use) HTML-interface. Additionally the backend supports
* authentication via HTTP-digest authorization.
* cmpc is a client with vdr-like osd-menues.
- *
+ *
* Copyright (c) 2012 Reinhard Mantey, some rights reserved!
* published under Creative Commons by-sa
* For details see http://creativecommons.org/licenses/by-sa/3.0/
- *
+ *
* The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp
- *
+ *
* --------------------------------------------------------------
*/
#ifndef HTTPRESPONSE_H
diff --git a/libs/networking/include/ServerConfig.h b/libs/networking/include/ServerConfig.h
index 0f9efec..88789cb 100644
--- a/libs/networking/include/ServerConfig.h
+++ b/libs/networking/include/ServerConfig.h
@@ -1,57 +1,73 @@
/**
* ======================== legal notice ======================
- *
+ *
* File: ServerConfig.h
* Created: 8. Juli 2012, 06
* Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
* Project: libnetworking: classes for tcp/ip sockets and http-protocol handling
- *
+ *
* CMP - compound media player
- *
+ *
* is a client/server mediaplayer intended to play any media from any workstation
* without the need to export or mount shares. cmps is an easy to use backend
* with a (ready to use) HTML-interface. Additionally the backend supports
* authentication via HTTP-digest authorization.
* cmpc is a client with vdr-like osd-menues.
- *
+ *
* Copyright (c) 2012 Reinhard Mantey, some rights reserved!
* published under Creative Commons by-sa
* For details see http://creativecommons.org/licenses/by-sa/3.0/
- *
+ *
* The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp
- *
+ *
* --------------------------------------------------------------
*/
#ifndef SERVERCONFIG_H
#define SERVERCONFIG_H
+#include <Persistable.h>
#include <ServerSocket.h>
#include <Authorization.h>
-class cServerConfig
-{
+class cServerConfig : public cPersistable {
public:
- cServerConfig(int Port);
+ cServerConfig(const char *ConfigBaseDir);
virtual ~cServerConfig();
bool AuthorizationRequired(void) { return authorizationRequired; }
const char *AppIconPath(void) const { return appIconPath; }
const char *DocumentRoot(void) const { return documentRoot; }
-
+ bool WantExtendedScan(void) const { return wantExtendedScan; }
+ const char *CredentialsFile(void) const { return credentialsFile; }
+ const char *MediaInfo(void) const { return mediaInfo; }
+ const char *FFMpeg(void) const { return ffmpeg; }
+ void Dump(void);
+ virtual int Load(const char *FileName);
+ virtual int Store(const char *FileName);
void SetAppIcon(const char *AppIcon);
void SetAuthorizationRequired(bool Authorize) { authorizationRequired = Authorize; }
+ void SetConfigBaseDir(const char *ConfigBaseDir);
+ void SetCredentialsFile(const char *FileName);
void SetDocumentRoot(const char *DocumentRoot);
+ void SetMediaInfo(const char *MediaInfo);
+ void SetFFMpeg(const char *FFMpeg);
void SetPort(int port);
+ void SetWantExtendedScan(bool wantScan) { wantExtendedScan = wantScan; }
private:
cServerSocket server;
cAuthorizations authorizations;
bool authorizationRequired;
+ bool wantExtendedScan;
+ char *configBaseDir;
+ char *credentialsFile;
char *documentRoot;
char *appIconPath;
+ char *mediaInfo;
+ char *ffmpeg;
friend class cHTTPServer;
friend class cConnectionHandler;
-};
+ };
#endif /* SERVERCONFIG_H */
diff --git a/libs/networking/include/Url.h b/libs/networking/include/Url.h
deleted file mode 100644
index f4dc1af..0000000
--- a/libs/networking/include/Url.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * ======================== legal notice ======================
- *
- * File: Url.h
- * Created: 4. Juli 2012, 05
- * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
- * Project: libnetworking: classes for tcp/ip sockets and http-protocol handling
- *
- * CMP - compound media player
- *
- * is a client/server mediaplayer intended to play any media from any workstation
- * without the need to export or mount shares. cmps is an easy to use backend
- * with a (ready to use) HTML-interface. Additionally the backend supports
- * authentication via HTTP-digest authorization.
- * cmpc is a client with vdr-like osd-menues.
- *
- * Copyright (c) 2012 Reinhard Mantey, some rights reserved!
- * published under Creative Commons by-sa
- * For details see http://creativecommons.org/licenses/by-sa/3.0/
- *
- * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp
- *
- * --------------------------------------------------------------
- */
-#ifndef URL_H
-#define URL_H
-
-#include <stddef.h>
-#include <string>
-#include <tr1/unordered_map>
-class cURLEncoder;
-class cURLDecoder;
-
-class cUrl {
-///< splits an url into machine readable parts:
-///< from top-level sight, an url consists of url and querystring. Looking bit closer,
-///< the url consists of toplevel and path, where as the querystring is a list of
-///< name/value tuples with value being an optional part.
-public:
- cUrl(const char *RawURL);
- virtual ~cUrl();
- const char *Parameter(const char *Name);
- void SetParameter(const char* Name, const char* Value = NULL);
- size_t EstimatedSize(void) const; ///< is a rough guess about the size of the final encoded url
- void ParseURL(const char *URL);
- char *ToString(void) const; ///< writes the url to a newly allocated buffer
- int WriteBuf(char *buf, size_t bufSize) const; ///< writes the url to preexisting buffer
- ///< returns the characters written. -1 as return value indicates a buffer overrun.
- const char * Path() const { return path; }
-#ifdef DEBUG
- void Dump(void);
-#endif
- static void Cleanup(void);
- static cURLEncoder *Encoder(void);
- static cURLDecoder *Decoder(void);
-
-protected:
- void ParseQueryString(const char *QueryString);
-
-private:
- typedef std::tr1::unordered_map<std::string, std::string> ParameterMap;
- char *path;
- ParameterMap parameters;
- };
-
-#endif /* URL_H */
-