Click
Loading...
Searching...
No Matches
portinfo.hh
1// -*- c-basic-offset: 4; related-file-name: "../../../elements/standard/portinfo.cc" -*-
2#ifndef CLICK_PORTINFO_HH
3#define CLICK_PORTINFO_HH
4#include <click/element.hh>
5CLICK_DECLS
6
7/*
8=c
9
10PortInfo(NAME PORT[/PROTOCOL], ...)
11
12=s information
13
14stores named TCP/UDP port information
15
16=io
17
18None
19
20=d
21
22Lets you use mnemonic names for TCP and UDP ports. Each argument has the form
23`NAME PORT[/PROTOCOL]', which associates the given PORT/PROTOCOL pair with the
24NAME. If PROTOCOL is left off, the NAME applies to both TCP and UDP. For
25example, in a configuration containing
26
27 PortInfo(ssh 22, http 80),
28
29configuration strings can use C<ssh> and C<http> as mnemonics for the port
30numbers 22 and 80, respectively.
31
32PortInfo names are local with respect to compound elements. That is, names
33created inside a compound element apply only within that compound element and
34its subelements. For example:
35
36 PortInfo(src 10);
37 compound :: {
38 PortInfo(dst 100);
39 ... -> UDPIPEncap(1.0.0.1, src, 2.0.0.1, dst) -> ... // OK
40 };
41 ... -> UDPIPEncap(1.0.0.1, src, 2.0.0.1, dst) -> ...
42 // error: `dst' undefined
43
44=n
45
46If you do not define a port for a given name, PortInfo will use the default,
47if any. At user level, PortInfo uses the L<getservbyname(3)> function to look
48up ports by name. In the kernel, there are no default ports.
49
50PortInfo will parse arguments containing more than one name, as `C<NAME
51PORT/PROTOCOL NAME...>', and comments starting with `C<#>' are ignored. Thus,
52lines from F</etc/services> can be used verbatim as PortInfo configuration
53arguments.
54
55=a
56
57AddressInfo */
58
59class PortInfo : public Element { public:
60
61 PortInfo();
62
63 const char *class_name() const override { return "PortInfo"; }
64
65 int configure_phase() const { return CONFIGURE_PHASE_FIRST; }
67
68};
69
70CLICK_ENDDECLS
71#endif
Base class for Click elements.
Definition element.hh:42
virtual int configure_phase() const
Return the element's configure phase, which determines the order in which elements are configured and...
Definition element.cc:1308
virtual int configure(Vector< String > &conf, ErrorHandler *errh)
Parse the element's configuration arguments.
Definition element.cc:1372
virtual const char * class_name() const =0
Return the element's class name.
Error reporting class.
Definition error.hh:90
Vector template.
Definition vector.hh:111
Click's Element class.