summaryrefslogtreecommitdiffstats
path: root/Server/Plugins/NetworkTest/Info.lua
blob: 2788d3674e7479a89f99e7005fc7b6aa5891a1ef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165

-- Info.lua

-- Implements the g_PluginInfo standard plugin description

g_PluginInfo =
{
	Name = "NetworkTest",
	Version = "1",
	Date = "2015-01-28",
	Description = [[Implements test code (and examples) for the cNetwork API]],
	
	Commands =
	{
	},
	
	ConsoleCommands =
	{
		net =
		{
			Subcommands =
			{
				client =
				{
					HelpString = "Connects, as a client, to a specified webpage (google.com by default) and downloads its front page using HTTP",
					Handler = HandleConsoleNetClient,
					ParameterCombinations =
					{
						{
							Params = "",
							Help = "Connects, as a client, to google.com and downloads its front page using HTTP",
						},
						{
							Params = "host [port]",
							Help = "Connects, as a client, to the specified host and downloads its front page using HTTP",
						},
					},  -- ParameterCombinations
				},  -- client
				
				close =
				{
					HelpString = "Close a listening socket",
					Handler = HandleConsoleNetClose,
					ParameterCombinations =
					{
						{
							Params = "[Port]",
							Help = "Closes a socket listening on the specified port [1024]",
						},
					},  -- ParameterCombinations
				},  -- close
				
				ips =
				{
					HelpString = "Prints all locally available IP addresses",
					Handler = HandleConsoleNetIps,
				},  -- ips
				
				listen =
				{
					HelpString = "Creates a new listening socket on the specified port with the specified service attached to it",
					Handler = HandleConsoleNetListen,
					ParameterCombinations =
					{
						{
							Params = "[Port] [Service]",
							Help = "Starts listening on the specified port [1024] providing the specified service [echo]",
						},
					},  -- ParameterCombinations
				},  -- listen
				
				lookup =
				{
					HelpString = "Looks up the IP addresses corresponding to the given hostname  (google.com by default)",
					Handler = HandleConsoleNetLookup,
					ParameterCombinations =
					{
						{
							Params = "",
							Help = "Looks up the IP addresses of google.com.",
						},
						{
							Params = "Hostname",
							Help = "Looks up the IP addresses of the specified hostname.",
						},
						{
							Params = "IP",
							Help = "Looks up the canonical name of the specified IP.",
						},
					},
				},  -- lookup
				
				sclient =
				{
					HelpString = "Connects, as an SSL client, to a specified webpage (github.com by default) and downloads its front page using HTTPS",
					Handler = HandleConsoleNetSClient,
					ParameterCombinations =
					{
						{
							Params = "",
							Help = "Connects, as an SSL client, to github.com and downloads its front page using HTTPS",
						},
						{
							Params = "host [port]",
							Help = "Connects, as an SSL client, to the specified host and downloads its front page using HTTPS",
						},
					},  -- ParameterCombinations
				},  -- sclient

				udp =
				{
					Subcommands =
					{
						close =
						{
							Handler = HandleConsoleNetUdpClose,
							ParameterCombinations =
							{
								{
									Params = "[Port]",
									Help = "Closes the UDP endpoint on the specified port [1024].",
								}
							},
						},  -- close
						
						listen =
						{
							Handler = HandleConsoleNetUdpListen,
							ParameterCombinations =
							{
								{
									Params = "[Port]",
									Help = "Listens on the specified UDP port [1024], dumping the incoming datagrams into log",
								},
							},
						},  -- listen
						
						send =
						{
							Handler = HandleConsoleNetUdpSend,
							ParameterCombinations =
							{
								{
									Params = "[Host] [Port] [Message]",
									Help = "Sends the message [\"hello\"] through UDP to the specified host [localhost] and port [1024]",
								},
							},
						}  -- send
					},  -- Subcommands ("net udp")
				},  -- udp
				
				wasc =
				{
					HelpString = "Requests the webadmin homepage using https",
					Handler = HandleConsoleNetWasc,
				},  -- wasc
				
			},  -- Subcommands
		},  -- net
	},
}