更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
fixme.c 文件参考

浏览源代码.

函数

err_t netif_dhcp_off (struct netif *netif)
 
err_t dhcp_is_bound (struct netif *netif)
 
static err_t netifapi_do_dhcps_start (struct tcpip_api_call_data *m)
 
err_t netifapi_dhcps_start (struct netif *netif, char *start_ip, u16_t ip_num)
 
err_t netifapi_dhcps_stop (struct netif *netif)
 
static void tcp_unlock_accept (ip6_addr_t *ipaddr)
 
static void netif_ip6_addr_setinvalid (struct netif *netif, const ip6_addr_t *addr6)
 
err_t netif_do_rmv_ipv6_addr (struct netif *netif, void *arguments)
 
static err_t netif_do_rmv_ip6_address (struct tcpip_api_call_data *m)
 
void netifapi_netif_rmv_ip6_address (struct netif *netif, ip_addr_t *ipaddr)
 
static struct netif * netif_find_by_name (const char *name)
 
static err_t netifapi_do_find_by_name (struct tcpip_api_call_data *m)
 
struct netif * netifapi_netif_find_by_name (const char *name)
 
err_t netif_set_mtu (struct netif *netif, u16_t netif_mtu)
 
err_t netif_set_hwaddr (struct netif *netif, const unsigned char *hw_addr, int hw_len)
 
err_t etharp_update_arp_entry (struct netif *netif, const ip4_addr_t *ipaddr, struct eth_addr *ethaddr, u8_t flags)
 
err_t etharp_delete_arp_entry (struct netif *netif, ip4_addr_t *ipaddr)
 
err_t lwip_dns_setserver (u8_t numdns, ip_addr_t *dnsserver)
 
err_t lwip_dns_getserver (u8_t numdns, ip_addr_t *dnsserver)
 
int lwip_sntp_start (int server_num, char **sntp_server, struct timeval *time)
 
int ip6addr_aton (const char *cp, ip6_addr_t *addr)
 

变量

struct raw_pcb * pkt_raw_pcbs
 
struct raw_pcb * raw_pcbs
 
u32_t is_ip_conflict_signal = 0
 
sys_sem_t ip_conflict_detect
 
u32_t is_dup_detect_initialized = 0
 
sys_sem_t dup_addr_detect
 
const char *const tcp_state_str []
 
volatile int tcpip_init_finish = 1
 

函数说明

◆ dhcp_is_bound()

err_t dhcp_is_bound ( struct netif *  netif)

在文件 fixme.c82 行定义.

83{
84 struct dhcp *dhcp = NULL;
85
86 LWIP_ERROR("netif != NULL", (netif != NULL), return ERR_ARG);
87
88 dhcp = netif_dhcp_data(netif);
89 LWIP_ERROR("netif->dhcp != NULL", (dhcp != NULL), return ERR_ARG);
90
91 if (dhcp->state == DHCP_STATE_BOUND) {
92 return ERR_OK;
93 } else {
94 return ERR_INPROGRESS;
95 }
96}

◆ etharp_delete_arp_entry()

err_t etharp_delete_arp_entry ( struct netif *  netif,
ip4_addr_t *  ipaddr 
)

在文件 fixme.c337 行定义.

338{
339 (void)netif;
340 (void)ipaddr;
341 return 0;
342}
ARG_NUM_3 ARG_NUM_1 ARG_NUM_2 ARG_NUM_2 ARG_NUM_3 ARG_NUM_1 ARG_NUM_4 ARG_NUM_2 ARG_NUM_2 ARG_NUM_5 ARG_NUM_2 void
这是这个函数的调用关系图:

◆ etharp_update_arp_entry()

err_t etharp_update_arp_entry ( struct netif *  netif,
const ip4_addr_t *  ipaddr,
struct eth_addr *  ethaddr,
u8_t  flags 
)

在文件 fixme.c328 行定义.

329{
330 (void)netif;
331 (void)ipaddr;
332 (void)ethaddr;
333 (void)flags;
334 return 0;
335}
这是这个函数的调用关系图:

◆ ip6addr_aton()

int ip6addr_aton ( const char *  cp,
ip6_addr_t *  addr 
)

在文件 fixme.c405 行定义.

406{
407 const int ipv6_blocks = 8;
408 u16_t current_block_index = 0;
409 u16_t current_block_value = 0;
410 u16_t addr16[ipv6_blocks];
411 u16_t *a16 = (u16_t *)addr->addr;
412 int squash_pos = ipv6_blocks;
413 int i;
414 const char *s = cp;
415 const char *ss = cp-1;
416
417 for (; ; s++) {
418 if (current_block_index >= ipv6_blocks) {
419 return 0; // address too long
420 }
421 if (*s == 0) {
422 if (s - ss == 1) {
423 if (squash_pos != current_block_index) {
424 return 0; // empty address or address ends with a single ':'
425 } // else address ends with one valid "::"
426 } else {
427 addr16[current_block_index++] = current_block_value;
428 }
429 break;
430 } else if (*s == ':') {
431 if (s - ss == 1) {
432 if (s != cp || s[1] != ':') {
433 return 0; // address begins with a single ':' or contains ":::"
434 } // else address begins with one valid "::"
435 } else {
436 addr16[current_block_index++] = current_block_value;
437 }
438 if (s[1] == ':') {
439 if (squash_pos != ipv6_blocks) {
440 return 0; // more than one "::"
441 }
442 squash_pos = current_block_index;
443 s++;
444 }
445 ss = s; // ss points to the recent ':' position
446 current_block_value = 0;
447 } else if (lwip_isxdigit(*s) && (s - ss) < 5) { // 4 hex-digits at most
448 current_block_value = (current_block_value << 4) +
449 ((u8_t)(*s) | ('a' - 'A')) - '0' - ('a' - '9' - 1) * (*s >= 'A');
450#if LWIP_IPV4
451 } else if (*s == '.' && current_block_index < ipv6_blocks - 1) {
452 ip4_addr_t ip4;
453 int ret = ip4addr_aton(ss+1, &ip4);
454 if (!ret) {
455 return 0;
456 }
457 ip4.addr = lwip_ntohl(ip4.addr);
458 addr16[current_block_index++] = (u16_t)(ip4.addr >> 16);
459 addr16[current_block_index++] = (u16_t)(ip4.addr);
460 break;
461#endif /* LWIP_IPV4 */
462 } else {
463 return 0; // unexpected char or too many digits
464 }
465 }
466
467 if (squash_pos == ipv6_blocks && current_block_index != ipv6_blocks) {
468 return 0; // address too short
469 }
470 if (squash_pos != ipv6_blocks && current_block_index == ipv6_blocks) {
471 return 0; // unexpected "::" in address
472 }
473
474 for (i = 0; i < squash_pos; ++i) {
475 a16[i] = lwip_htons(addr16[i]);
476 }
477 for (; i < ipv6_blocks - current_block_index + squash_pos; ++i) {
478 a16[i] = 0;
479 }
480 for (; i < ipv6_blocks; ++i) {
481 a16[i] = lwip_htons(addr16[i - ipv6_blocks + current_block_index]);
482 }
483
484 return 1;
485}
这是这个函数的调用关系图:

◆ lwip_dns_getserver()

err_t lwip_dns_getserver ( u8_t  numdns,
ip_addr_t *  dnsserver 
)

在文件 fixme.c352 行定义.

353{
354 (void)numdns;
355 (void)dnsserver;
356 return 0;
357}
这是这个函数的调用关系图:

◆ lwip_dns_setserver()

err_t lwip_dns_setserver ( u8_t  numdns,
ip_addr_t *  dnsserver 
)

在文件 fixme.c345 行定义.

346{
347 (void)numdns;
348 (void)dnsserver;
349 return 0;
350}
这是这个函数的调用关系图:

◆ lwip_sntp_start()

int lwip_sntp_start ( int  server_num,
char **  sntp_server,
struct timeval *  time 
)

在文件 fixme.c379 行定义.

380{
381 (void)server_num;
382 (void)sntp_server;
383 (void)time;
384 return 0;
385}
time_t time(time_t *t)
Definition: time.c:1224
函数调用图:
这是这个函数的调用关系图:

◆ netif_dhcp_off()

err_t netif_dhcp_off ( struct netif *  netif)

在文件 fixme.c54 行定义.

55{
56 ip_addr_t old_ipaddr;
57 ip_addr_t old_netmask;
58 ip_addr_t old_gateway;
59
60 if (netif == NULL) {
61 return ERR_VAL;
62 }
63 old_ipaddr = netif->ip_addr;
64 old_netmask = netif->netmask;
65 old_gateway = netif->gw;
66
67 if (netif_dhcp_data(netif)) {
68 (void)dhcp_release(netif);
69 (void)dhcp_stop(netif);
70 (void)dhcp_cleanup(netif);
71 LWIP_DEBUGF(NETIF_DEBUG, ("DHCP is close;set static IP\n"));
72 }
73
74 ip_addr_set_val(&netif->ip_addr, &old_ipaddr);
75 ip_addr_set_val(&netif->netmask, &old_netmask);
76 ip_addr_set_val(&netif->gw, &old_gateway);
77 (void)netif_set_up(netif);
78
79 return ERR_OK;
80}
这是这个函数的调用关系图:

◆ netif_do_rmv_ip6_address()

static err_t netif_do_rmv_ip6_address ( struct tcpip_api_call_data *  m)
static

在文件 fixme.c178 行定义.

179{
180 /* cast through void* to silence alignment warnings.
181 * We know it works because the structs have been instantiated as struct netifapi_msg */
182 struct netifapi_msg *msg = (struct netifapi_msg *)(void *)m;
183
184 return netif_do_rmv_ipv6_addr(msg->netif, (void *)msg->msg.add.ipaddr);
185}
err_t netif_do_rmv_ipv6_addr(struct netif *netif, void *arguments)
Definition: fixme.c:165
函数调用图:
这是这个函数的调用关系图:

◆ netif_do_rmv_ipv6_addr()

err_t netif_do_rmv_ipv6_addr ( struct netif *  netif,
void arguments 
)

在文件 fixme.c165 行定义.

166{
167 ip_addr_t *ipaddr = (ip_addr_t *)arguments;
168
169 if (IP_IS_V6(ipaddr)) {
170#if LWIP_TCP
171 tcp_unlock_accept(ip_2_ip6(ipaddr));
172#endif
173 netif_ip6_addr_setinvalid(netif, ip_2_ip6(ipaddr));
174 }
175 return ERR_OK;
176}
static void netif_ip6_addr_setinvalid(struct netif *netif, const ip6_addr_t *addr6)
Definition: fixme.c:150
static void tcp_unlock_accept(ip6_addr_t *ipaddr)
Definition: fixme.c:145
函数调用图:
这是这个函数的调用关系图:

◆ netif_find_by_name()

static struct netif * netif_find_by_name ( const char *  name)
static

在文件 fixme.c205 行定义.

206{
207 struct netif *netif = NULL;
208
209 LWIP_ASSERT_CORE_LOCKED();
210
211 if (name == NULL) {
212 return NULL;
213 }
214
215 NETIF_FOREACH(netif) {
216 if (strcmp("lo", name) == 0 && (netif->name[0] == 'l' && netif->name[1] == 'o')) {
217 LWIP_DEBUGF(NETIF_DEBUG, ("netif_find_by_name: found lo\n"));
218 return netif;
219 }
220
221 if (strcmp(netif->full_name, name) == 0) {
222 LWIP_DEBUGF(NETIF_DEBUG, ("netif_find_by_name: found %s\n", name));
223 return netif;
224 }
225 }
226
227 LWIP_DEBUGF(NETIF_DEBUG, ("netif_find_by_name: didn't find %s\n", name));
228 return NULL;
229}
这是这个函数的调用关系图:

◆ netif_ip6_addr_setinvalid()

static void netif_ip6_addr_setinvalid ( struct netif *  netif,
const ip6_addr_t *  addr6 
)
static

在文件 fixme.c150 行定义.

151{
152 s8_t idx;
153 LWIP_ERROR("netif_ip6_addr_set : invalid arguments", (netif != NULL), return);
154 LWIP_ERROR("netif_ip6_addr_set : invalid arguments", (addr6 != NULL), return);
155
156 idx = netif_get_ip6_addr_match(netif, addr6);
157 if (idx < 0) {
158 return;
159 }
160
161 netif_ip6_addr_set_state(netif, idx, IP6_ADDR_INVALID);
162 return;
163}
这是这个函数的调用关系图:

◆ netif_set_hwaddr()

err_t netif_set_hwaddr ( struct netif *  netif,
const unsigned char *  hw_addr,
int  hw_len 
)

在文件 fixme.c297 行定义.

298{
299 LWIP_ERROR("netif_set_hwaddr : invalid arguments", (netif != NULL), return ERR_VAL);
300
301 LWIP_ERROR("netif_set_hwaddr : invalid arguments", (hw_addr != NULL), return ERR_VAL);
302
303 LWIP_ERROR("netif_set_hwaddr: invalid arguments",
304 ((unsigned int)hw_len == NETIF_MAX_HWADDR_LEN), return ERR_VAL);
305
306 if (netif->drv_set_hwaddr == NULL) {
307 return ERR_IF; // ERR_OPNOTSUPP;
308 }
309
310 if (netif->drv_set_hwaddr(netif, (u8_t *)hw_addr, hw_len) != ERR_OK) {
311 return ERR_VAL;
312 }
313
314 if (memcpy_s(netif->hwaddr, NETIF_MAX_HWADDR_LEN, hw_addr, hw_len) != EOK) {
315 LWIP_DEBUGF(NETIF_DEBUG, ("netif_set_hwaddr: memcpy_s error\n"));
316 return ERR_VAL;
317 }
318
319 LWIP_DEBUGF(NETIF_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE,
320 ("netif: HW address of interface %s set to %02X:%02X:%02X:%02X:%02X:%02X\n",
321 netif_get_name(netif),
322 netif->hwaddr[0], netif->hwaddr[1], netif->hwaddr[2],
323 netif->hwaddr[3], netif->hwaddr[4], netif->hwaddr[5]));
324
325 return ERR_OK;
326}
这是这个函数的调用关系图:

◆ netif_set_mtu()

err_t netif_set_mtu ( struct netif *  netif,
u16_t  netif_mtu 
)

在文件 fixme.c270 行定义.

271{
272 /*
273 * As per RFC 791, "Every internet module must be able to forward a datagram of 68
274 * octets without further fragmentation. This is because an internet header
275 * may be up to 60 octets, and the minimum fragment is 8 octets."
276 */
277 LWIP_ERROR("netif_set_mtu: invalid arguments", (netif != NULL), return ERR_VAL);
278
279#if LWIP_IPV6
280 LWIP_ERROR("netif_set_mtu: invalid arguments", (netif_mtu >= NETIF_MTU_MIN) && (netif_mtu <= IP_FRAG_MAX_MTU),
281 return ERR_ARG);
282#else
283 LWIP_ERROR("netif_set_mtu: invalid arguments", (netif_mtu >= IP_FRAG_MIN_MTU) && (netif_mtu <= IP_FRAG_MAX_MTU),
284 return ERR_ARG);
285#endif
286
287 netif->mtu = netif_mtu;
288#if LWIP_IPV6 && LWIP_ND6_ALLOW_RA_UPDATES
289 netif->mtu6 = netif_mtu;
290#endif /* LWIP_IPV6 && LWIP_ND6_ALLOW_RA_UPDATES */
291
292 LWIP_DEBUGF(NETIF_DEBUG | LWIP_DBG_STATE, ("netif: MTU of interface %s is changed to %d\n",
293 netif_get_name(netif), netif->mtu));
294 return ERR_OK;
295}
这是这个函数的调用关系图:

◆ netifapi_dhcps_start()

err_t netifapi_dhcps_start ( struct netif *  netif,
char *  start_ip,
u16_t  ip_num 
)

在文件 fixme.c114 行定义.

115{
116 err_t err;
117 NETIFAPI_VAR_DECLARE(msg);
118
119 LWIP_ERROR("netifapi_dhcps_start : invalid arguments", (netif != NULL), return ERR_VAL);
120 NETIFAPI_VAR_ALLOC(msg);
121
122 NETIFAPI_VAR_REF(msg).netif = netif;
123 NETIFAPI_VAR_REF(msg).msg.dhcp_start_params.start_ip = start_ip;
124 NETIFAPI_VAR_REF(msg).msg.dhcp_start_params.ip_num = ip_num;
125
126 err = tcpip_api_call(netifapi_do_dhcps_start, &API_VAR_REF(msg).call);
127
128 NETIFAPI_VAR_FREE(msg);
129 return err;
130}
static err_t netifapi_do_dhcps_start(struct tcpip_api_call_data *m)
Definition: fixme.c:104
函数调用图:

◆ netifapi_dhcps_stop()

err_t netifapi_dhcps_stop ( struct netif *  netif)

在文件 fixme.c132 行定义.

133{
134 LWIP_ERROR("netifapi_dhcps_stop : invalid arguments", (netif != NULL), return ERR_VAL);
135
136 return netifapi_netif_common(netif, dhcps_stop, NULL);
137}
void dhcps_stop(struct netif *netif)
Definition: dhcps.c:964
函数调用图:

◆ netifapi_do_dhcps_start()

static err_t netifapi_do_dhcps_start ( struct tcpip_api_call_data *  m)
static

在文件 fixme.c104 行定义.

105{
106 /* cast through void* to silence alignment warnings.
107 * We know it works because the structs have been instantiated as struct netifapi_msg */
108 err_t ret;
109 struct netifapi_msg *msg = (struct netifapi_msg *)(void *)m;
110 ret = dhcps_start(msg->netif, msg->msg.dhcp_start_params.start_ip, msg->msg.dhcp_start_params.ip_num);
111 return ret;
112}
err_t dhcps_start(struct netif *netif, const char *start_ip, u16_t ip_num)
Definition: dhcps.c:857
函数调用图:
这是这个函数的调用关系图:

◆ netifapi_do_find_by_name()

static err_t netifapi_do_find_by_name ( struct tcpip_api_call_data *  m)
static

在文件 fixme.c231 行定义.

232{
233 /* cast through void* to silence alignment warnings.
234 * We know it works because the structs have been instantiated as struct netifapi_msg */
235 struct netifapi_msg *msg = (struct netifapi_msg *)(void *)m;
236
237 msg->netif = netif_find_by_name(msg->msg.ifs.name);
238 return ERR_OK;
239}
static struct netif * netif_find_by_name(const char *name)
Definition: fixme.c:205
函数调用图:
这是这个函数的调用关系图:

◆ netifapi_netif_find_by_name()

struct netif * netifapi_netif_find_by_name ( const char *  name)

在文件 fixme.c241 行定义.

242{
243 struct netif *netif = NULL;
244 NETIFAPI_VAR_DECLARE(msg);
245 NETIFAPI_VAR_ALLOC(msg);
246
247 NETIFAPI_VAR_REF(msg).netif = NULL;
248#if LWIP_MPU_COMPATIBLE
249 if (strncpy_s(NETIFAPI_VAR_REF(msg).msg.ifs.name, NETIF_NAMESIZE, name, NETIF_NAMESIZE - 1)) {
250 NETIFAPI_VAR_FREE(msg);
251 return netif;
252 }
253 NETIFAPI_VAR_REF(msg).msg.ifs.name[NETIF_NAMESIZE - 1] = '\0';
254#else
255 NETIFAPI_VAR_REF(msg).msg.ifs.name = (char *)name;
256#endif /* LWIP_MPU_COMPATIBLE */
257
258 (void)tcpip_api_call(netifapi_do_find_by_name, &API_VAR_REF(msg).call);
259
260 netif = msg.netif;
261 NETIFAPI_VAR_FREE(msg);
262 return netif;
263}
static err_t netifapi_do_find_by_name(struct tcpip_api_call_data *m)
Definition: fixme.c:231
函数调用图:
这是这个函数的调用关系图:

◆ netifapi_netif_rmv_ip6_address()

void netifapi_netif_rmv_ip6_address ( struct netif *  netif,
ip_addr_t *  ipaddr 
)

在文件 fixme.c187 行定义.

188{
189 err_t err;
190 if (netif == NULL) {
191 return;
192 }
193 NETIFAPI_VAR_DECLARE(msg);
194 NETIFAPI_VAR_ALLOC(msg);
195
196 NETIFAPI_VAR_REF(msg).netif = netif;
197 NETIFAPI_VAR_REF(msg).msg.add.ipaddr = (void *)ipaddr;
198
199 err = tcpip_api_call(netif_do_rmv_ip6_address, &API_VAR_REF(msg).call);
200
201 NETIFAPI_VAR_FREE(msg);
202 (void)err;
203}
static err_t netif_do_rmv_ip6_address(struct tcpip_api_call_data *m)
Definition: fixme.c:178
函数调用图:

◆ tcp_unlock_accept()

static void tcp_unlock_accept ( ip6_addr_t *  ipaddr)
static

在文件 fixme.c145 行定义.

146{
147 (void)ipaddr;
148}
这是这个函数的调用关系图:

变量说明

◆ dup_addr_detect

sys_sem_t dup_addr_detect

在文件 fixme.c373 行定义.

◆ ip_conflict_detect

sys_sem_t ip_conflict_detect

在文件 fixme.c369 行定义.

◆ is_dup_detect_initialized

u32_t is_dup_detect_initialized = 0

在文件 fixme.c372 行定义.

◆ is_ip_conflict_signal

u32_t is_ip_conflict_signal = 0

在文件 fixme.c368 行定义.

◆ pkt_raw_pcbs

struct raw_pcb* pkt_raw_pcbs

在文件 fixme.c360 行定义.

◆ raw_pcbs

struct raw_pcb* raw_pcbs

在文件 fixme.c364 行定义.

◆ tcp_state_str

const char* const tcp_state_str[]
初始值:
= {
"CLOSED",
"LISTEN",
"SYN_SENT",
"SYN_RCVD",
"ESTABLISHED",
"FIN_WAIT_1",
"FIN_WAIT_2",
"CLOSE_WAIT",
"CLOSING",
"LAST_ACK",
"TIME_WAIT"
}

在文件 fixme.c389 行定义.

◆ tcpip_init_finish

volatile int tcpip_init_finish = 1

在文件 fixme.c403 行定义.