126 { IPPORT_PRINTER, "PRINTER" },
127 { 530, "COURIER" },
128 { 540, "UUCP" },
129 { 600, "PCSERVER" },
130 { IPPORT_SOCKS, "SOCKS" },
131 { 1524, "INGRESLOCK" },
132 { 2904, "M2UA" },
133 { 2905, "M3UA" },
134 { 6000, "XWIN" },
135 { IPPORT_HTTP_ALT, "HTTP (proxy)" },
136 { 9900, "IUA" },
137 { 0, NULL },
138 };
139
140 char *
141 getportname(int proto, in_port_t port)
142 {
143 const struct porttable *p, *pt;
144
145 switch (proto) {
146 case IPPROTO_SCTP: /* fallthru */
147 case IPPROTO_TCP: pt = pt_tcp; break;
148 case IPPROTO_UDP: pt = pt_udp; break;
149 default: return (NULL);
150 }
151
152 for (p = pt; p->pt_num; p++) {
153 if (port == p->pt_num)
154 return (p->pt_short);
155 }
156 return (NULL);
157 }
158
159 int
160 reservedport(int proto, int port)
161 {
162 const struct porttable *p, *pt;
163
164 switch (proto) {
165 case IPPROTO_TCP: pt = pt_tcp; break;
166 case IPPROTO_UDP: pt = pt_udp; break;
|
126 { IPPORT_PRINTER, "PRINTER" },
127 { 530, "COURIER" },
128 { 540, "UUCP" },
129 { 600, "PCSERVER" },
130 { IPPORT_SOCKS, "SOCKS" },
131 { 1524, "INGRESLOCK" },
132 { 2904, "M2UA" },
133 { 2905, "M3UA" },
134 { 6000, "XWIN" },
135 { IPPORT_HTTP_ALT, "HTTP (proxy)" },
136 { 9900, "IUA" },
137 { 0, NULL },
138 };
139
140 char *
141 getportname(int proto, in_port_t port)
142 {
143 const struct porttable *p, *pt;
144
145 switch (proto) {
146 case IPPROTO_DCCP: /* fallthru */
147 case IPPROTO_SCTP:
148 case IPPROTO_TCP: pt = pt_tcp; break;
149 case IPPROTO_UDP: pt = pt_udp; break;
150 default: return (NULL);
151 }
152
153 for (p = pt; p->pt_num; p++) {
154 if (port == p->pt_num)
155 return (p->pt_short);
156 }
157 return (NULL);
158 }
159
160 int
161 reservedport(int proto, int port)
162 {
163 const struct porttable *p, *pt;
164
165 switch (proto) {
166 case IPPROTO_TCP: pt = pt_tcp; break;
167 case IPPROTO_UDP: pt = pt_udp; break;
|