Move several port number #defines to iana.h

This commit is contained in:
Dirk Ziegelmeier 2017-08-08 11:37:08 +02:00
parent 5193844ac4
commit 0eb8d19e82
12 changed files with 43 additions and 34 deletions

View File

@ -62,6 +62,7 @@
#include "lwip/ip_addr.h"
#include "lwip/mem.h"
#include "lwip/prot/dns.h"
#include "lwip/prot/iana.h"
#include <string.h>
@ -89,7 +90,6 @@ static const ip_addr_t v4group = DNS_MQUERY_IPV4_GROUP_INIT;
static const ip_addr_t v6group = DNS_MQUERY_IPV6_GROUP_INIT;
#endif
#define MDNS_PORT 5353
#define MDNS_TTL 255
/* Stored offsets to beginning of domain names
@ -1251,7 +1251,7 @@ mdns_init_outpacket(struct mdns_outpacket *out, struct mdns_packet *in)
SMEMCPY(&out->dest_addr, &in->source_addr, sizeof(ip_addr_t));
out->dest_port = in->source_port;
if (in->source_port != MDNS_PORT) {
if (in->source_port != LWIP_IANA_PORT_MDNS) {
out->unicast_reply = 1;
out->cache_flush = 0;
if (in->questions == 1) {
@ -1457,7 +1457,7 @@ mdns_send_outpacket(struct mdns_outpacket *outpkt)
if (outpkt->unicast_reply) {
udp_sendto_if(mdns_pcb, outpkt->pbuf, &outpkt->dest_addr, outpkt->dest_port, outpkt->netif);
} else {
udp_sendto_if(mdns_pcb, outpkt->pbuf, mcast_destaddr, MDNS_PORT, outpkt->netif);
udp_sendto_if(mdns_pcb, outpkt->pbuf, mcast_destaddr, LWIP_IANA_PORT_MDNS, outpkt->netif);
}
}
@ -1504,7 +1504,7 @@ mdns_announce(struct netif *netif, const ip_addr_t *destination)
}
}
announce.dest_port = MDNS_PORT;
announce.dest_port = LWIP_IANA_PORT_MDNS;
SMEMCPY(&announce.dest_addr, destination, sizeof(announce.dest_addr));
mdns_send_outpacket(&announce);
}
@ -2100,7 +2100,7 @@ mdns_resp_init(void)
#else
mdns_pcb->ttl = MDNS_TTL;
#endif
res = udp_bind(mdns_pcb, IP_ANY_TYPE, MDNS_PORT);
res = udp_bind(mdns_pcb, IP_ANY_TYPE, LWIP_IANA_PORT_MDNS);
LWIP_UNUSED_ARG(res); /* in case of LWIP_NOASSERT */
LWIP_ASSERT("Failed to bind pcb", res == ERR_OK);
udp_recv(mdns_pcb, mdns_recv, NULL);

View File

@ -49,12 +49,10 @@
#include "lwip/def.h"
#include "lwip/udp.h"
#include "lwip/netif.h"
#include "lwip/prot/iana.h"
#include <string.h>
/** default port number for "NetBIOS Name service */
#define NETBIOS_PORT 137
/** size of a NetBIOS name */
#define NETBIOS_NAME_LEN 16
@ -329,7 +327,7 @@ netbiosns_init(void)
if (netbiosns_pcb != NULL) {
/* we have to be allowed to send broadcast packets! */
ip_set_option(netbiosns_pcb, SOF_BROADCAST);
udp_bind(netbiosns_pcb, IP_ANY_TYPE, NETBIOS_PORT);
udp_bind(netbiosns_pcb, IP_ANY_TYPE, LWIP_IANA_PORT_NETBIOS);
udp_recv(netbiosns_pcb, netbiosns_recv, netbiosns_pcb);
}
}

View File

@ -57,17 +57,6 @@
extern "C" {
#endif
/* The listen port of the SNMP agent. Clients have to make their requests to
this port. Most standard clients won't work if you change this! */
#ifndef SNMP_IN_PORT
#define SNMP_IN_PORT 161
#endif
/* The remote port the SNMP agent sends traps to. Most standard trap sinks won't
work if you change this! */
#ifndef SNMP_TRAP_PORT
#define SNMP_TRAP_PORT 162
#endif
/* version defines used in PDU */
#define SNMP_VERSION_1 0
#define SNMP_VERSION_2c 1

View File

@ -42,6 +42,7 @@
#include "lwip/udp.h"
#include "snmp_msg.h"
#include "lwip/sys.h"
#include "lwip/prot/iana.h"
/** SNMP netconn API worker thread */
static void
@ -55,10 +56,10 @@ snmp_netconn_thread(void *arg)
/* Bind to SNMP port with default IP address */
#if LWIP_IPV6
conn = netconn_new(NETCONN_UDP_IPV6);
netconn_bind(conn, IP6_ADDR_ANY, SNMP_IN_PORT);
netconn_bind(conn, IP6_ADDR_ANY, LWIP_IANA_PORT_SNMP);
#else /* LWIP_IPV6 */
conn = netconn_new(NETCONN_UDP);
netconn_bind(conn, IP4_ADDR_ANY, SNMP_IN_PORT);
netconn_bind(conn, IP4_ADDR_ANY, LWIP_IANA_PORT_SNMP);
#endif /* LWIP_IPV6 */
LWIP_ERROR("snmp_netconn: invalid conn", (conn != NULL), return;);

View File

@ -39,6 +39,7 @@
#include "lwip/udp.h"
#include "lwip/ip.h"
#include "lwip/prot/iana.h"
#include "snmp_msg.h"
/* lwIP UDP receive callback function */
@ -92,8 +93,8 @@ snmp_init(void)
snmp_traps_handle = snmp_pcb;
udp_recv(snmp_pcb, snmp_recv, (void *)SNMP_IN_PORT);
err = udp_bind(snmp_pcb, IP_ANY_TYPE, SNMP_IN_PORT);
udp_recv(snmp_pcb, snmp_recv, NULL);
err = udp_bind(snmp_pcb, IP_ANY_TYPE, LWIP_IANA_PORT_SNMP);
LWIP_ERROR("snmp_raw: Unable to bind PCB", (err == ERR_OK), return;);
}

View File

@ -46,6 +46,7 @@
#include "lwip/sys.h"
#include "lwip/apps/snmp.h"
#include "lwip/apps/snmp_core.h"
#include "lwip/prot/iana.h"
#include "snmp_msg.h"
#include "snmp_asn1.h"
#include "snmp_core_priv.h"
@ -216,7 +217,7 @@ snmp_send_trap(const struct snmp_obj_id* eoid, s32_t generic_trap, s32_t specifi
snmp_stats.outpkts++;
/** send to the TRAP destination */
snmp_sendto(snmp_traps_handle, p, &td->dip, SNMP_TRAP_PORT);
snmp_sendto(snmp_traps_handle, p, &td->dip, LWIP_IANA_PORT_SNMP_TRAP);
pbuf_free(p);
} else {
err = ERR_MEM;

View File

@ -42,6 +42,7 @@
#define LWIP_HDR_APPS_HTTPD_OPTS_H
#include "lwip/opt.h"
#include "lwip/prot/iana.h"
/**
* @defgroup httpd_opts Options
@ -129,12 +130,12 @@
/** The server port for HTTPD to use */
#if !defined HTTPD_SERVER_PORT || defined __DOXYGEN__
#define HTTPD_SERVER_PORT 80
#define HTTPD_SERVER_PORT LWIP_IANA_PORT_HTTP
#endif
/** The https server port for HTTPD to use */
#if !defined HTTPD_SERVER_PORT_HTTPS || defined __DOXYGEN__
#define HTTPD_SERVER_PORT_HTTPS 443
#define HTTPD_SERVER_PORT_HTTPS LWIP_IANA_PORT_HTTPS
#endif
/** Enable https support? */

View File

@ -40,6 +40,7 @@
#include "lwip/apps/mqtt_opts.h"
#include "lwip/err.h"
#include "lwip/ip_addr.h"
#include "lwip/prot/iana.h"
#ifdef __cplusplus
extern "C" {
@ -53,10 +54,10 @@ struct altcp_tls_config;
/** @ingroup mqtt
* Default MQTT port (non-TLS) */
#define MQTT_PORT 1883
#define MQTT_PORT LWIP_IANA_PORT_MQTT
/** @ingroup mqtt
* Default MQTT TLS port */
#define MQTT_TLS_PORT 8883
#define MQTT_TLS_PORT LWIP_IANA_PORT_SEQURE_MQTT
/*---------------------------------------------------------------------------------------------- */
/* Connection with server */

View File

@ -3,11 +3,12 @@
#include "lwip/apps/smtp_opts.h"
#include "lwip/err.h"
#include "lwip/prot/iana.h"
/** The default TCP port used for SMTP */
#define SMTP_DEFAULT_PORT 25
#define SMTP_DEFAULT_PORT LWIP_IANA_PORT_SMTP
/** The default TCP port used for SMTPS */
#define SMTPS_DEFAULT_PORT 465
#define SMTPS_DEFAULT_PORT LWIP_IANA_PORT_SMTPS
/** Email successfully sent */
#define SMTP_RESULT_OK 0

View File

@ -38,6 +38,7 @@
#define LWIP_HDR_APPS_SNTP_OPTS_H
#include "lwip/opt.h"
#include "lwip/prot/iana.h"
/**
* @defgroup sntp_opts Options
@ -83,7 +84,7 @@
/** SNTP server port */
#if !defined SNTP_PORT || defined __DOXYGEN__
#define SNTP_PORT 123
#define SNTP_PORT LWIP_IANA_PORT_SNTP
#endif
/** Sanity check:

View File

@ -42,6 +42,7 @@
#define LWIP_HDR_APPS_TFTP_OPTS_H
#include "lwip/opt.h"
#include "lwip/prot/iana.h"
/**
* @defgroup tftp_opts Options
@ -60,7 +61,7 @@
* TFTP server port
*/
#if !defined TFTP_PORT || defined __DOXYGEN__
#define TFTP_PORT 69
#define TFTP_PORT LWIP_IANA_PORT_TFTP
#endif
/**

View File

@ -43,7 +43,21 @@ extern "C" {
#endif
/** Hardware types */
#define LWIP_IANA_HWTYPE_ETHERNET 1
#define LWIP_IANA_HWTYPE_ETHERNET 1
/** Port numbers */
#define LWIP_IANA_PORT_SMTP 25
#define LWIP_IANA_PORT_TFTP 69
#define LWIP_IANA_PORT_HTTP 80
#define LWIP_IANA_PORT_SNTP 123
#define LWIP_IANA_PORT_NETBIOS 137
#define LWIP_IANA_PORT_SNMP 161
#define LWIP_IANA_PORT_SNMP_TRAP 162
#define LWIP_IANA_PORT_HTTPS 443
#define LWIP_IANA_PORT_SMTPS 465
#define LWIP_IANA_PORT_MQTT 1883
#define LWIP_IANA_PORT_MDNS 5353
#define LWIP_IANA_PORT_SEQURE_MQTT 8883
#ifdef __cplusplus
}