summaryrefslogtreecommitdiff
path: root/src/sh/net.cc
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2011-10-08 20:30:28 +0200
committerHenrik Rydberg <rydberg@euromail.se>2011-10-08 20:30:28 +0200
commit5df79c53745fde5d6c3340a2979b1429cd5892c1 (patch)
tree1a81af141708b826e9c61e8a04019994fcca8298 /src/sh/net.cc
Initial import of htcd system 1.0
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/sh/net.cc')
-rw-r--r--src/sh/net.cc122
1 files changed, 122 insertions, 0 deletions
diff --git a/src/sh/net.cc b/src/sh/net.cc
new file mode 100644
index 0000000..dc03901
--- /dev/null
+++ b/src/sh/net.cc
@@ -0,0 +1,122 @@
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#include <sh/htc.h>
21
22/////////////////////////////////////////////////////////////////
23
24TOK_IMPL(sethost)
25{
26 Req(env)->htc()->setHost(env[0]);
27}
28TOK_IMPL(setdomain)
29{
30 Req(env)->htc()->setDomain(env[0]);
31}
32TOK_IMPL(setport)
33{
34 Req(env)->htc()->setPort(atoi(env[0]));
35}
36TOK_IMPL(setmailer)
37{
38 Req(env)->htc()->setMailer(env[0]);
39}
40
41/////////////////////////////////////////////////////////////////
42
43TOK_IMPL(HOST) {
44 out<<Req(env)->htc()->host;
45}
46
47TOK_IMPL(HOSTIP) {
48 out<<Req(env)->htc()->node.ip;
49}
50
51TOK_IMPL(DOMAIN) {
52 out<<Req(env)->htc()->domain;
53}
54
55TOK_IMPL(ROOT) {
56 out<<Req(env)->htc()->username;
57 if(Req(env)->htc()->domain.size()) out<<"@"<<Req(env)->htc()->domain;
58}
59
60TOK_IMPL(ADMIN) {
61 out<<Req(env)->htc()->username;
62 if(Req(env)->htc()->domain.size()) out<<"@"<<Req(env)->htc()->domain;
63}
64
65TOK_IMPL(port)
66{
67 out<<Req(env)->htc()->port;
68}
69
70/////////////////////////////////////////////////////////////
71
72void envAddNet(tokmap& T)
73{
74 TOK_ADD(sethost,"x",tok_t::SYSONLY,
75 "%Set host name\n"
76 "%Syntax: \\sethost{host}\n"
77 );
78 TOK_ADD(setdomain,"x",tok_t::SYSONLY,
79 "%Set default domain\n"
80 "%Syntax: \\setdomain{domain}\n"
81 );
82 TOK_ADD(setport,"x",tok_t::SYSONLY,
83 "%Set host port number\n"
84 "%Syntax: \\setport{port}\n"
85 );
86 TOK_ADD(setmailer,"x",tok_t::SYSONLY,
87 "%Set mail program path\n"
88 "%Syntax: \\setmailer{path}\n"
89 );
90
91 /////////////////////////////////////////////////////////////
92
93 TOK_ADD(HOST,"",tok_t::PUBLIC,
94 "%Host name\n"
95 "%Syntax: \\HOST\n"
96 );
97
98 TOK_ADD(HOSTIP,"",tok_t::PUBLIC,
99 "%Host IP address\n"
100 "%Syntax: \\HOSTIP\n"
101 );
102
103 TOK_ADD(DOMAIN,"",tok_t::PUBLIC,
104 "%Default domain\n"
105 "%Syntax: \\DOMAIN\n"
106 );
107
108 TOK_ADD(ROOT,"",tok_t::PUBLIC,
109 "%htcroot email address\n"
110 "%Syntax: \\ROOT\n"
111 );
112
113 TOK_ADD(ADMIN,"",tok_t::PUBLIC,
114 "%admin email address\n"
115 "%Syntax: \\ADMIN\n"
116 );
117
118 TOK_ADD(port,"",tok_t::PUBLIC,
119 "%Host port number\n"
120 "%Syntax: \\port\n"
121 );
122}