mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-12 16:50:21 +00:00
improve IPCP, add IPV6CP and support for IPv6
This commit is contained in:
1 parent
ba47e29c28
commit
1c7be6d543
9 files changed
+347
-224
No files matched your search
+40
-38
@@ -1247,6 +1247,7 @@ size_t mg_print_ip_port(void (*out)(char, void *), void *arg, va_list *ap);
|
||||
size_t mg_print_ip4(void (*out)(char, void *), void *arg, va_list *ap);
|
||||
size_t mg_print_ip6(void (*out)(char, void *), void *arg, va_list *ap);
|
||||
size_t mg_print_mac(void (*out)(char, void *), void *arg, va_list *ap);
|
||||
size_t mg_print_ieee64(void (*out)(char, void *), void *arg, va_list *ap);
|
||||
size_t mg_print_l2addr(void (*out)(char, void *), void *arg, va_list *ap);
|
||||
|
||||
// Various output functions
|
||||
@@ -3219,7 +3220,9 @@ enum mg_l2type { MG_TCPIP_L2_ETH = 0, MG_TCPIP_L2_PPP, MG_TCPIP_L2_PPPoE};
|
||||
|
||||
struct mg_l2addr {
|
||||
union {
|
||||
uint8_t mac[6];
|
||||
uint8_t mac[6]; // ieee48
|
||||
uint64_t ieee64; // PPP ifcid
|
||||
uint16_t ieee16;
|
||||
} addr;
|
||||
};
|
||||
|
||||
@@ -3345,8 +3348,7 @@ struct mg_tcpip_if {
|
||||
#define MG_TCPIP_STATE_REQ 3 // Interface is up, DHCP REQUESTING state
|
||||
#define MG_TCPIP_STATE_IP 4 // Interface is up and has an IP assigned
|
||||
#define MG_TCPIP_STATE_READY 5 // Interface has fully come up, ready to work
|
||||
bool gw_ready; // We've got a hw address for the router
|
||||
bool driver_up; // Driver reports link state is up
|
||||
bool gw_ready; // We've got a hw address for the router
|
||||
#if MG_ENABLE_IPV6
|
||||
uint8_t gw6mac[sizeof(struct mg_l2addr)]; // IPV6 Router's hw address
|
||||
uint8_t state6; // Current IPv6 state
|
||||
@@ -4032,41 +4034,6 @@ struct mg_tcpip_driver_tms570_data {
|
||||
|
||||
|
||||
|
||||
#if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_XMC7) && MG_ENABLE_DRIVER_XMC7
|
||||
|
||||
struct mg_tcpip_driver_xmc7_data {
|
||||
int mdc_cr; // Valid values: -1, 0, 1, 2, 3, 4, 5
|
||||
uint8_t phy_addr;
|
||||
};
|
||||
|
||||
#ifndef MG_TCPIP_PHY_ADDR
|
||||
#define MG_TCPIP_PHY_ADDR 0
|
||||
#endif
|
||||
|
||||
#ifndef MG_DRIVER_MDC_CR
|
||||
#define MG_DRIVER_MDC_CR 3
|
||||
#endif
|
||||
|
||||
#define MG_TCPIP_DRIVER_INIT(mgr) \
|
||||
do { \
|
||||
static struct mg_tcpip_driver_xmc7_data driver_data_; \
|
||||
static struct mg_tcpip_if mif_; \
|
||||
driver_data_.mdc_cr = MG_DRIVER_MDC_CR; \
|
||||
driver_data_.phy_addr = MG_TCPIP_PHY_ADDR; \
|
||||
mif_.ip = MG_TCPIP_IP; \
|
||||
mif_.mask = MG_TCPIP_MASK; \
|
||||
mif_.gw = MG_TCPIP_GW; \
|
||||
mif_.driver = &mg_tcpip_driver_xmc7; \
|
||||
mif_.driver_data = &driver_data_; \
|
||||
MG_SET_MAC_ADDRESS(mif_.mac); \
|
||||
mg_tcpip_init(mgr, &mif_); \
|
||||
MG_INFO(("Driver: xmc7, MAC: %M", mg_print_mac, mif_.mac)); \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_XMC) && MG_ENABLE_DRIVER_XMC
|
||||
|
||||
struct mg_tcpip_driver_xmc_data {
|
||||
@@ -4113,6 +4080,41 @@ struct mg_tcpip_driver_xmc_data {
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_XMC7) && MG_ENABLE_DRIVER_XMC7
|
||||
|
||||
struct mg_tcpip_driver_xmc7_data {
|
||||
int mdc_cr; // Valid values: -1, 0, 1, 2, 3, 4, 5
|
||||
uint8_t phy_addr;
|
||||
};
|
||||
|
||||
#ifndef MG_TCPIP_PHY_ADDR
|
||||
#define MG_TCPIP_PHY_ADDR 0
|
||||
#endif
|
||||
|
||||
#ifndef MG_DRIVER_MDC_CR
|
||||
#define MG_DRIVER_MDC_CR 3
|
||||
#endif
|
||||
|
||||
#define MG_TCPIP_DRIVER_INIT(mgr) \
|
||||
do { \
|
||||
static struct mg_tcpip_driver_xmc7_data driver_data_; \
|
||||
static struct mg_tcpip_if mif_; \
|
||||
driver_data_.mdc_cr = MG_DRIVER_MDC_CR; \
|
||||
driver_data_.phy_addr = MG_TCPIP_PHY_ADDR; \
|
||||
mif_.ip = MG_TCPIP_IP; \
|
||||
mif_.mask = MG_TCPIP_MASK; \
|
||||
mif_.gw = MG_TCPIP_GW; \
|
||||
mif_.driver = &mg_tcpip_driver_xmc7; \
|
||||
mif_.driver_data = &driver_data_; \
|
||||
MG_SET_MAC_ADDRESS(mif_.mac); \
|
||||
mg_tcpip_init(mgr, &mif_); \
|
||||
MG_INFO(("Driver: xmc7, MAC: %M", mg_print_mac, mif_.mac)); \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user