aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-12-10 00:05:13 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2009-12-10 00:09:44 +0200
commite668360caeb54d64b67130f6f4f674d8738a909a (patch)
treea361085cf1fafee2afa4a89a18b2f4815736a5cd
parent41c55a1a93840363c996fc9aae54329dadcf0a86 (diff)
downloadpies-e668360caeb54d64b67130f6f4f674d8738a909a.tar.gz
pies-e668360caeb54d64b67130f6f4f674d8738a909a.tar.bz2
Update
* doc/macros.texi (xprindex) (example-output, mtasimopt): Remove (RFC): New macro. * doc/pies.texi: Document inetd-style components. * doc/Makefile.am (fix-sentence-spacing): Fix rule. * src/progman.c (progman_lookup_tcpmux): Use case-insensitive comparison, as required by RFC.
-rw-r--r--doc/Makefile.am2
-rw-r--r--doc/macros.texi17
-rw-r--r--doc/pies.texi262
-rw-r--r--src/progman.c2
4 files changed, 250 insertions, 33 deletions
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 73bd72a..21618f0 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -144,7 +144,7 @@ fix-sentence-spacing:
144 do \ 144 do \
145 if grep -q '\. [@A-Z]' $$file; then \ 145 if grep -q '\. [@A-Z]' $$file; then \
146 mv $$file $${file}~; \ 146 mv $$file $${file}~; \
147 sed -r 's/\. ([@A-Z])/. \1/g' $${file}~ > $$file; \ 147 sed -r -f fix-sentence-spacing.sed $${file}~ > $$file; \
148 fi; \ 148 fi; \
149 done 149 done
150 150
diff --git a/doc/macros.texi b/doc/macros.texi
index a26ad0c..bc9fd0a 100644
--- a/doc/macros.texi
+++ b/doc/macros.texi
@@ -10,21 +10,8 @@
10@xopindex{\option\, summary} 10@xopindex{\option\, summary}
11@end macro 11@end macro
12 12
13@macro xprindex{option} 13@macro RFC{number}
14@ifclear ANCHOR-PR-\option\ 14@uref{http://tools.ietf.org/html/rfc\number\, RFC \number\}
15@set ANCHOR-PR-\option\ 1
16@anchor{pragma \option\}
17@end ifclear
18@end macro
19
20@macro example-output{text}
21@smallexample
22\text\
23@end smallexample
24@end macro
25
26@macro mtasimopt{option,text}
27@mtindex \option\, --\option\, @r{@command{mtasim} option, \text\}
28@end macro 15@end macro
29 16
30 17
diff --git a/doc/pies.texi b/doc/pies.texi
index e21ea62..d5e9d02 100644
--- a/doc/pies.texi
+++ b/doc/pies.texi
@@ -126,6 +126,12 @@ Component Statement
126* Meta1-Style Components:: 126* Meta1-Style Components::
127* Component Syntax Summary:: 127* Component Syntax Summary::
128 128
129Inetd-Style Components
130
131* builtin:: Built-in Inetd Services
132* TCPMUX:: TCPMUX Services
133* sockenv:: Socket Environment Variables
134
129Global Configuration 135Global Configuration
130 136
131* Less Useful Statements:: 137* Less Useful Statements::
@@ -632,6 +638,7 @@ statement. Its value will be available to the program as
632@code{argv[0]}. 638@code{argv[0]}.
633@end deffn 639@end deffn
634 640
641@anchor{flags}
635@deffn {Config: component} flags (@var{flag-list}) 642@deffn {Config: component} flags (@var{flag-list})
636Define flags for this component. The @var{flag-list} is a 643Define flags for this component. The @var{flag-list} is a
637comma-separated list of flags. Valid flags are: 644comma-separated list of flags. Valid flags are:
@@ -662,7 +669,7 @@ This is an internal inetd component. @xref{builtin}.
662 669
663@item sockenv 670@item sockenv
664This inetd component wants socket description variables in its 671This inetd component wants socket description variables in its
665environment. @FIXME-xref{sockenv}. 672environment. @xref{sockenv}.
666 673
667@item resolve 674@item resolve
668When used with @samp{sockenv}, the @env{LOCALHOST} and 675When used with @samp{sockenv}, the @env{LOCALHOST} and
@@ -1075,6 +1082,7 @@ provided that @code{chdir} statement is used for this component
1075@end table 1082@end table
1076@end deffn 1083@end deffn
1077 1084
1085@anchor{socket-type}
1078@deffn {Config: component} socket-type @var{type} 1086@deffn {Config: component} socket-type @var{type}
1079Sets the socket type. Allowed values for @var{type} are: 1087Sets the socket type. Allowed values for @var{type} are:
1080@samp{stream}, @samp{dgram}, @samp{raw}, @samp{rdm}, 1088@samp{stream}, @samp{dgram}, @samp{raw}, @samp{rdm},
@@ -1100,26 +1108,227 @@ opened connections.
1100@menu 1108@menu
1101* builtin:: Built-in Inetd Services 1109* builtin:: Built-in Inetd Services
1102* TCPMUX:: TCPMUX Services 1110* TCPMUX:: TCPMUX Services
1111* sockenv:: Socket Environment Variables
1103@end menu 1112@end menu
1104 1113
1105@node builtin 1114@node builtin
1106@subsubsection Built-in Inetd Services 1115@subsubsection Built-in Inetd Services
1107@cindex builtin services 1116@cindex builtin services
1108@WRITEME 1117@cindex internal services
1118@dfn{Built-in} or @dfn{internal} services are such inetd-style
1119components that are supported internally by @command{pies} and do not
1120require external programs. In @command{pies} version @value{VERSION}
1121those are:
1122
1123@table @asis
1124@cindex echo
1125@item echo
1126Send back any received data. Defined in @RFC{862}.
1127@cindex discard
1128@item discard
1129Read the data and discard them. Defined in @RFC{863}.
1130@cindex time
1131@item time
1132Return a machine readable date and time as seconds since the Epoch.
1133Defined in @RFC{868}.
1134@cindex daytime
1135@item daytime
1136Return current date and time in human-readable format. Defined in
1137@RFC{867}.
1138@cindex chargen
1139@item chargen
1140Send a continuous stream of ASCII printable characters without regard
1141to the input. Defined in @RFC{864}
1142@cindex qotd
1143@item qotd
1144Send a @samp{quotation of the day} text without regard
1145to the input. Defined in @RFC{865}.
1146@cindex tcpmux
1147@item tcpmux
1148TCP Port Service Multiplexer. Defined in @RFC{1078}.
1149@end table
1150
1151@cindex @code{internal} flag
1152A definition of a built-in service component must
1153have the @code{internal} flag (@pxref{flags}). It may not have
1154@code{command} or @code{program} statements, as built-in services do
1155not need external programs. Instead, it must have a @dfn{service}
1156declaration:
1157
1158@deffn {Config: component} service @var{name}
1159Set the built-in service name. Its argument is one of the keywords
1160listed in the above table.
1161@end deffn
1162
1163 For example, the following component declaration defines a standard
1164TCP-based echo service:
1165
1166@smallexample
1167@group
1168component echo @{
1169 socket "inet://0.0.0.0:echo";
1170 service echo;
1171 flags internal;
1172@}
1173@end group
1174@end smallexample
1175
1176 It corresponds to the following @file{inetd.conf} line:
1177
1178@smallexample
1179echo stream tcp nowait root internal
1180@end smallexample
1181
1182 Another built-in services are defined in the same manner, replacing
1183@samp{echo} in the @code{service} field with the corresponding service
1184name.
1185
1186 The @samp{qotd} service reads the contents of the @dfn{qotd file}
1187and sends it back to the client. By default the @samp{qotd} file
1188is located in the local state directory and named
1189@file{@var{instance}.qotd} (where @var{instance} is the name of the
1190@command{pies} instance, @FIXME-pxref{instances}). This default location
1191can be changed using the following statement:
1192
1193@deffn {Config} qotd-file @var{file-name}
1194Set the name of the @samp{quotation-of-the-day} file.
1195@end deffn
1196
1197 The text read from the @samp{qotd} file is preprocessed, by
1198replacing each @acronym{LF} character (@acronym{ASCII} 10) with two
1199characters: @acronym{CR} (@acronym{ASCII} 13) followed by
1200@acronym{LF}. The resulting text is truncated to 512 characters.
1201
1202 The use of @samp{tcpmux} services is covered below.
1109 1203
1110@node TCPMUX 1204@node TCPMUX
1111@subsubsection TCPMUX Services 1205@subsubsection TCPMUX Services
1112@cindex TCPMUX 1206@cindex TCPMUX
1113@UNREVISED 1207
1208 TCPMUX allows to use multiple services on a single well-known TCP
1209port using a service name instead of a well-known number. It is
1210defined in @RFC{1078}. The protocol operation is as follows.
1211The @dfn{master} TCPMUX component listens on a certain TCP port
1212(usually on port 1) for incoming requests. After connecting to the
1213master, the client sends the name of the service it wants, followed
1214by a carriage-return line-feed (@acronym{CRLF}). @command{Pies}
1215looks up this name in the list of services handled by the master
1216(@dfn{subordinate services}) and reports with @samp{+} or @samp{-}
1217followed by optional text and terminated with the @acronym{CRLF},
1218depending on whether such service name is found or not. If the reply
1219was @samp{+}, @command{pies} then starts the requested component.
1220Otherwise, it closes the connection.
1221
1222 TCPMUX service names are case-insensitive. The special service
1223@samp{help} is always defined; it outputs a list of all the
1224subordinate services, one name per line, and closes the connection.
1225
1226 The master TCPMUX service is declared as a usual built-in service,
1227e.g.:
1228
1229@smallexample
1230component tcpmux-master @{
1231 socket "inet://0.0.0.0:1";
1232 service tcpmux;
1233 flags internal;
1234@}
1235@end smallexample
1236
1237 Any number of subordinate services may be defined for each master.
1238A subordinate server component definition must contain at least the
1239following statements:
1114 1240
1115@deffn {Config: component} service @var{name} 1241@deffn {Config: component} service @var{name}
1116Sets the name of the service for TCPMUX sub-services. 1242Sets the name of the subordinate service. The @var{name} will be compared