Add several constants needed to use multicast UDP

This was verified by @todbot to work on esp32 s2 and s3;
the constant should match any system that uses LWIP numbering.
This commit is contained in:
Jeff Epler 2023-08-21 15:57:45 -05:00
parent 4593008317
commit d23ddff971
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
2 changed files with 11 additions and 0 deletions

View File

@ -82,6 +82,10 @@ MP_DEFINE_EXCEPTION(gaierror, OSError)
//| TCP_NODELAY: int //| TCP_NODELAY: int
//| //|
//| IPPROTO_TCP: int //| IPPROTO_TCP: int
//| IPPROTO_IP: int
//|
//| IP_MULTICAST_TTL: int
//|
//| def socket(self, family: int = AF_INET, type: int = SOCK_STREAM) -> socketpool.Socket: //| def socket(self, family: int = AF_INET, type: int = SOCK_STREAM) -> socketpool.Socket:
//| """Create a new socket //| """Create a new socket
//| //|
@ -182,6 +186,8 @@ STATIC const mp_rom_map_elem_t socketpool_socketpool_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_TCP_NODELAY), MP_ROM_INT(SOCKETPOOL_TCP_NODELAY) }, { MP_ROM_QSTR(MP_QSTR_TCP_NODELAY), MP_ROM_INT(SOCKETPOOL_TCP_NODELAY) },
{ MP_ROM_QSTR(MP_QSTR_IPPROTO_TCP), MP_ROM_INT(SOCKETPOOL_IPPROTO_TCP) }, { MP_ROM_QSTR(MP_QSTR_IPPROTO_TCP), MP_ROM_INT(SOCKETPOOL_IPPROTO_TCP) },
{ MP_ROM_QSTR(MP_QSTR_IPPROTO_IP), MP_ROM_INT(SOCKETPOOL_IPPROTO_IP) },
{ MP_ROM_QSTR(MP_QSTR_IP_MULTICAST_TTL), MP_ROM_INT(SOCKETPOOL_IP_MULTICAST_TTL) },
{ MP_ROM_QSTR(MP_QSTR_EAI_NONAME), MP_ROM_INT(SOCKETPOOL_EAI_NONAME) }, { MP_ROM_QSTR(MP_QSTR_EAI_NONAME), MP_ROM_INT(SOCKETPOOL_EAI_NONAME) },
}; };

View File

@ -45,6 +45,7 @@ typedef enum {
} socketpool_socketpool_addressfamily_t; } socketpool_socketpool_addressfamily_t;
typedef enum { typedef enum {
SOCKETPOOL_IPPROTO_IP = 0,
SOCKETPOOL_IPPROTO_TCP = 6, SOCKETPOOL_IPPROTO_TCP = 6,
} socketpool_socketpool_ipproto_t; } socketpool_socketpool_ipproto_t;
@ -52,6 +53,10 @@ typedef enum {
SOCKETPOOL_TCP_NODELAY = 1, SOCKETPOOL_TCP_NODELAY = 1,
} socketpool_socketpool_tcpopt_t; } socketpool_socketpool_tcpopt_t;
typedef enum {
SOCKETPOOL_IP_MULTICAST_TTL = 5,
} socketpool_socketpool_ipopt_t;
typedef enum { typedef enum {
SOCKETPOOL_EAI_NONAME = -2, SOCKETPOOL_EAI_NONAME = -2,
} socketpool_eai_t; } socketpool_eai_t;