root/config.c

Revision a29e2e492d5b03e2ab7a9aced0d1313f06a650c0, 2.8 kB (checked in by D.J. Capelis <dev@…>, 23 months ago)

Cleanup s/_TYPE/_SERVICE/ and implement LIST command, HELP now complaint
with RFC 1078

  • Property mode set to 100644
Line 
1#include"main.h"
2
3struct service help;
4struct service list;
5struct service multiplex;
6struct service ssl;
7struct service auth;
8struct service host;
9struct service shell;
10struct service echo;
11struct service hello;
12struct service rot13;
13struct service web;
14struct service web2;
15
16struct sockaddr_in6 shellsocket;
17struct sockaddr_in6 shellsocket2;
18struct sockaddr_in6 s_hello;
19struct sockaddr_in6 s_rot13;
20struct sockaddr_in6 s_web;
21struct sockaddr_in6 s_web2;
22
23char * listmsg;
24int listlen;
25
26void config_do()
27{
28    help.name = "HELP\0";
29    help.service_type = HELP_SERVICE;
30    help.next = &list;
31    list.name = "LIST\0";
32    list.service_type = LIST_SERVICE;
33    list.next = &multiplex;
34    multiplex.name = "MULTIPLEX\0";
35    multiplex.service_type = MULTIPLEX_SERVICE;
36    multiplex.next = &ssl;
37    ssl.name = "SSL\0";
38    ssl.service_type = SSL_SERVICE;
39    ssl.next = &auth;
40    auth.name = "AUTH\0";
41    auth.service_type = AUTH_SERVICE;
42    auth.next = &host;
43    host.name = "HOST\0";
44    host.service_type = HOST_SERVICE;
45    host.next = &shell;
46    shell.name = "SHELL\0";
47    shell.service_type = CUSTOM_SERVICE;
48    inet_pton(AF_INET6, "::ffff:127.0.0.1", &(shellsocket.sin6_addr));
49    shellsocket.sin6_family=AF_INET6;
50    shellsocket.sin6_port=htons(9000);
51    shell.info = &shellsocket;
52    shell.restrict_user = "demo";
53    shell.next = &echo;
54    echo.name = "ECHO\0";
55    echo.service_type = CUSTOM_SERVICE;
56    inet_pton(AF_INET6, "::ffff:127.0.0.1", &(shellsocket2.sin6_addr));
57    shellsocket2.sin6_family=AF_INET6;
58    shellsocket2.sin6_port=htons(9001);
59    echo.info = &shellsocket2;
60    echo.restrict_host = "toys";
61    echo.next = &hello;
62    hello.name = "HELLO\0";
63    hello.service_type = CUSTOM_SERVICE;
64    inet_pton(AF_INET6, "::ffff:127.0.0.1", &(s_hello.sin6_addr));
65    s_hello.sin6_family=AF_INET6;
66    s_hello.sin6_port=htons(9002);
67    hello.info = &s_hello;
68    hello.restrict_host = "toys";
69    hello.next = &web;
70    rot13.name = "ROT13\0";
71    rot13.service_type = CUSTOM_SERVICE;
72    inet_pton(AF_INET6, "::ffff:127.0.0.1", &(s_rot13.sin6_addr));
73    s_rot13.sin6_family=AF_INET6;
74    s_rot13.sin6_port=htons(9003);
75    rot13.info = &s_rot13;
76    rot13.restrict_host = "toys";
77    rot13.next = &web;
78    web.name = "WEB\0";
79    web.service_type = CUSTOM_SERVICE;
80    inet_pton(AF_INET6, "::ffff:127.0.0.1", &(s_web.sin6_addr));
81    s_web.sin6_family=AF_INET6;
82    s_web.sin6_port=htons(9004);
83    web.info = &s_web;
84    web.restrict_host = "main";
85    web.next = &web2;
86    web2.name = "WEB\0";
87    web2.service_type = CUSTOM_SERVICE;
88    inet_pton(AF_INET6, "::ffff:127.0.0.1", &(s_web2.sin6_addr));
89    s_web2.sin6_family=AF_INET6;
90    s_web2.sin6_port=htons(9005);
91    web2.info = &s_web2;
92    web2.restrict_host = "toys";
93    web2.next = NULL;
94
95    port_number = 31337;
96    servicelist = &help;
97}
Note: See TracBrowser for help on using the browser.