diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2011-10-08 20:30:28 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2011-10-08 20:30:28 +0200 |
| commit | 5df79c53745fde5d6c3340a2979b1429cd5892c1 (patch) | |
| tree | 1a81af141708b826e9c61e8a04019994fcca8298 /src/sh/htc.h | |
Initial import of htcd system 1.0
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/sh/htc.h')
| -rw-r--r-- | src/sh/htc.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/sh/htc.h b/src/sh/htc.h new file mode 100644 index 0000000..b566176 --- /dev/null +++ b/src/sh/htc.h | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | /************************************************************************* | ||
| 2 | * | ||
| 3 | * HTCd - Copyright (C) 1998-2006 Henrik Rydberg | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2 of the License, or | ||
| 8 | * (at your option) any later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program; if not, write to the Free Software | ||
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 18 | */ | ||
| 19 | |||
| 20 | #ifndef HTCH | ||
| 21 | #define HTCH | ||
| 22 | |||
| 23 | #include <sh/user.h> | ||
| 24 | #include <lang/env.h> | ||
| 25 | #include <mt/config.h> | ||
| 26 | |||
| 27 | /////////////////////////////////////////////////// | ||
| 28 | |||
| 29 | mstring Cwd(); | ||
| 30 | |||
| 31 | const mstring USERMAP=htchome()+sref("/htc/users.hdb"); | ||
| 32 | |||
| 33 | /////////////////////////////////////////////////// | ||
| 34 | |||
| 35 | struct HTC : public Lang { | ||
| 36 | fp_stream syslog; | ||
| 37 | mstring docroot,username; | ||
| 38 | mstring host,domain,mailer; | ||
| 39 | IPnode node; | ||
| 40 | int port; | ||
| 41 | |||
| 42 | HTC(const sref& root); | ||
| 43 | ~HTC(); | ||
| 44 | |||
| 45 | void setHost(const sref& s); | ||
| 46 | void setDomain(const sref& s); | ||
| 47 | void setPort(int p); | ||
| 48 | void setMailer(const sref& s); | ||
| 49 | }; | ||
| 50 | |||
| 51 | /////////////////////////////////////////////////// | ||
| 52 | |||
| 53 | struct htc_user { | ||
| 54 | tokmap toks; | ||
| 55 | |||
| 56 | htc_user(tokmap& p); | ||
| 57 | }; | ||
| 58 | |||
| 59 | /////////////////////////////////////////////////// | ||
| 60 | |||
| 61 | struct htc_req : public req_env { | ||
| 62 | mstring group; | ||
| 63 | user_t user; | ||
| 64 | |||
| 65 | HTC* htc() { return (HTC*)glob; } | ||
| 66 | |||
| 67 | htc_req(HTC& g,tokmap& p); | ||
| 68 | }; | ||
| 69 | |||
| 70 | inline htc_req* Req(Env& env) { return (htc_req*)env.req; } | ||
| 71 | inline const sref& DocRoot(Env& env) { return Req(env)->htc()->docroot; } | ||
| 72 | inline mstring DocPath(Env& env,const sref& uri) { return DocRoot(env)+env.URI(uri); } | ||
| 73 | |||
| 74 | /////////////////////////////////////////////////// | ||
| 75 | |||
| 76 | #endif | ||
| 77 | |||
