Debian Codegraph @

doc/html/fmtconfi.htm

raw
1 <HTML>
2 <HEAD>
3 <TITLE>Connection filtering (Appendix 15)</TITLE>
4 </HEAD>
5 <BODY BACKGROUND="/back_fbb.jpg">
6 <P>
7 <IMG SRC="/fbb.gif" WIDTH="32" HEIGHT="32">
8 <H1 ALIGN=Center>
9 Connections filtering<SMALL>.</SMALL>
10 </H1>
11 <P ALIGN=Center>
12 (Appendix 15)
13 <P>
14 FBB software allows filtering on connection. Filtering is not done by the
15 <PRE>BBS software but by external programs developed by users.
16
17 When the BBS starts, the C_FILTER does not really need to be there. But at
18 the first connect it must exist. If it does not exist at THAT time, it will
19 not be checked again. So if a C_FILTER is added after that, the BBS must be
20 rebooted for the filter to take effect.
21
22 Connection filter may be interactive and allows to incorporate some features
23 like dedicated information for predefined callsigns, password filtering,
24 etc...
25
26 The C_FILTER program must be found by the PATH of MsDos. Its extension can
27 be COM or EXE, and it must be little and fast as multitasking is stopped
28 during the activity of this program. If this program is not found, it will
29 not be called until the BBS is rebooted.
30
31 The C_FILTER may also be created as a DLL. Both for WinFBB and DosFBB (!!).
32 The filter must be installed in the path (\FBB\BIN) of Dos.
33
34 When receiving the connection, the C_FILTER program (if found) is called
35 with some arguments including a level number. This number is incremented each
36 time the program is called in the same connection session. The first time the
37 level number will be 0.
38
39 The line arguments given to the C_FILTER program are :
40
41 - Callsign (format as F6FBB-8).
42 - Level number (0 is the first time, up to 99).
43 - Flags of the user (binary number as user's mask of INIT.SRV).
44 - New : Flag indicating if the user is unknown in the BBS database.
45 - Record number of the user in INF.SYS.
46 - New: one more parameter before the optional text. It indicates the
47 port where was connected the user.
48 - Received data (in one argument).
49
50
51 The C_FILTER program ends with an exit value. This value is very important
52 and tells the BBS what to do :
53
54 Return value (for C_FILTER):
55 0 : Connection is accepted
56 1 : C_FILTER will called again, level is incremented
57 2 : Connection is refused, user is disconnected
58 3 : Connection is accepted, but in read-only mode
59 4 : Connection is accepted, but messages will be hold.
60 100 and up
61 : C_FILTER will called again, next level is equal to the return value.
62
63
64
65
66 Example of C_FILTERs. First C_FILTER.EXE, next C_FILTER.DLL:
67
68 <BIG><B>Example C_FILTER.EXE:</B></BIG>
69
70 /*
71 * C_FILTER.C
72 *
73 * Connection filter for FBB BBS software. (C) F6FBB 1991.
74 *
75 */
76
77 #include &lt;stdio.h&gt;
78
79 /*
80 * Connexion filter called for each connection.
81 * All datas sent to stdout will be sent to the user.
82 *
83 * Filter is called with some arguments on the command line :
84 * C_FILTER CallSign Level Flags New Record ReceivedData....
85 *
86 * The return value tells the BBS if C_FILTER must be called again or not
87 * 0 if the BBS can go on,
88 * 1 if the C_FILTER must be called again
89 * 2 if the user must be disconnected.
90 *
91 * Callsign is in the FORM CALLSIGN-SSID (F6FBB-0).
92 *
93 * The first time C_FILTER is called Level=0, and then will be incremented
94 * each time it is called for the same connection.
95 *
96 * Flags give the flags of the user (MGPBSXLE) in a bit field. as defined
97 * in the INIT.SRV user's mask. (0x80=Modem, 0x40=Guest, etc...)
98 *
99 * If New=1, then this is the first connection of the user on the BBS.
100 * Record is the record number in the INF.SYS file.
101 *
102 * All other arguments are the words sent by the user
103 * (password for instance).
104 *
105 * The number of arguments is variable and depends of the number of words
106 * in the answer of the user.
107 *
108 */
109
110
111 /*
112 * This is only a little example to test the system. It will be called
113 * four times and will give the list of arguments.
114 *
115 * The fourth time, the hand will be given back to the BBS.
116 */
117
118 main(int ac, char **av)
119 {
120 int i;
121 int level = atoi(av[2]); /* Get level from argument list */
122 /* and transform it to integer */
123
124 if (level == 0) { /* Is level equal to 0 ? */
125 printf("Connection line :\n"); /* This is the first call */
126 for (i = 0 ; i &lt; ac ; i++) /* List line arguments */
127 printf("%s ", av[i]);
128 putchar('\n');
129 return(1); /* C_FILTER must be called again */
130 }
131 else {
132 printf("Following line :\n"); /* These are other lines */
133 for (i = 0 ; i &lt; ac ; i++) /* List line arguments */
134 printf("%s ", av[i]);
135 putchar('\n');
136 if (level == 4) /* Is it the last time ? */
137 return(0); /* Yes, go on BBS */
138 else
139 return(1); /* No, call once more C_FILTER */
140 }
141 }
142
143
144 <BIG><B>Next example, C_FILTER.DLL:</B></BIG>
145
146 #define STRICT
147 #include &lt;stdio.h&gt;
148 #include &lt;windows.h&gt;
149
150 /*
151 * Code (C) F6FBB 1995-1996
152 *
153 * C_FILTER example
154 *
155 * svc_main is the only exported function. It must exist as WFBB will
156 * look for it. All filters are in the same format. If not NULL,
157 * r_buf allow to give a direct text back to the BBS
158 * The size of the buffer is given by the parameter len.
159 *
160 * Answers may also go to stdout (slower...).
161 *
162 * This code is only an example and was not fully tested. It could
163 * give problems as I am not an expert !
164 *
165 * The used compiler is a Borland C++ 4.5
166 *
167 * The DLL is not linked with the code, but checked and loaded when
168 * needed by WFBB.
169 *
170 * This is an example of the C_FILTER.DEF file :
171 *
172 * LIBRARY C_FILTER
173 * DESCRIPTION 'C_FILTER DLL for FBB'
174 * EXETYPE WINDOWS
175 * CODE PRELOAD MOVEABLE DISCARDABLE
176 * DATA PRELOAD MOVEABLE SINGLE
177 * HEAPSIZE 1024
178 *
179 *
180 * Parameters are (for C_FILTER):
181 * ac[0] : The name of the filter (C_FILTER)
182 * ac[1] : The callsign and SSID
183 * ac[2] : Level number (from 0)
184 * ac[3] : Flags
185 * ac[4] : Boolean for new user
186 * ac[5] : Recordnumber in INF.SYS
187 * ac[6] : Port number
188 * ac[7] : Optionnal Command received
189 * r_buf : The buffer to put an answer
190 * len : The size of the answer buffer
191 *
192 * Return value (for C_FILTER):
193 * 0 : Connection is accepted
194 * 1 : C_FILTER will called again, level is incremented
195 * 2 : Connection is refused, user is disconnected
196 * 3 : Connection is accepted, but in read-only mode
197 * 4 : Connection is accepted, but messages will be hold.
198 * 100 and up
199 * : C_FILTER will called again, next level is equal to the return value.
200 *
201 */
202
203 int _export FAR PASCAL svc_main (int ac, char FAR ** av, char FAR * r_buf, int len)
204 {
205 if (len &gt; 20)
206 {
207 sprintf (r_buf, "Inside the C_FILTER\r");
208 }
209 return (0);
210 }
211
212 <A HREF="doc.htm"><IMG SRC="/contents.gif" WIDTH="108" HEIGHT="28"></A>
213 </PRE>
214 <PRE>
215 <A HREF="/"><IMG SRC="../button_home.gif" WIDTH="90" HEIGHT="29"></A>
216
217 <FONT COLOR="#800000">This page was last updated <!--#config timefmt="%d-%b-%y"--><!--#echo var="LAST_MODIFIED"--></FONT>
218
219 </PRE>
220 </BODY></HTML>