Lines Matching refs:entry
148 * like one entry (used/free) */
216 /* DNS table entry states */
224 /** DNS table entry */
246 /** DNS request table entry: used when dns_gehostbyname cannot answer the
441 struct local_hostlist_entry *entry;
450 entry = (struct local_hostlist_entry *)memp_malloc(MEMP_LOCALHOSTLIST);
451 LWIP_ASSERT("mem-error in dns_init_local", entry != NULL);
452 if (entry != NULL) {
453 char *entry_name = (char *)entry + sizeof(struct local_hostlist_entry);
456 entry->name = entry_name;
457 entry->addr = init_entry->addr;
458 entry->next = local_hostlist_dynamic;
459 local_hostlist_dynamic = entry;
469 * @param iterator_fn a function that is called for every entry in the local host-list
478 struct local_hostlist_entry *entry = local_hostlist_dynamic;
480 while (entry != NULL) {
482 iterator_fn(entry->name, &entry->addr, iterator_arg);
485 entry = entry->next;
522 struct local_hostlist_entry *entry = local_hostlist_dynamic;
523 while (entry != NULL) {
524 if ((lwip_stricmp(entry->name, hostname) == 0) &&
525 LWIP_DNS_ADDRTYPE_MATCH_IP(dns_addrtype, entry->addr)) {
527 ip_addr_copy(*addr, entry->addr);
531 entry = entry->next;
563 struct local_hostlist_entry *entry = local_hostlist_dynamic;
565 while (entry != NULL) {
566 if (((hostname == NULL) || !lwip_stricmp(entry->name, hostname)) &&
567 ((addr == NULL) || ip_addr_cmp(&entry->addr, addr))) {
570 last_entry->next = entry->next;
572 local_hostlist_dynamic = entry->next;
574 free_entry = entry;
575 entry = entry->next;
579 last_entry = entry;
580 entry = entry->next;
591 * @param hostname hostname of the new entry
592 * @param addr IP address of the new entry
598 struct local_hostlist_entry *entry;
604 entry = (struct local_hostlist_entry *)memp_malloc(MEMP_LOCALHOSTLIST);
605 if (entry == NULL) {
608 entry_name = (char *)entry + sizeof(struct local_hostlist_entry);
611 entry->name = entry_name;
612 ip_addr_copy(entry->addr, *addr);
613 entry->next = local_hostlist_dynamic;
614 local_hostlist_dynamic = entry;
650 /* Walk through name list, return entry if found. If not, return NULL. */
671 * entry (otherwise, answers might arrive late for hostname not on the list
778 * @param idx the DNS table entry index for which to send a request
792 struct dns_table_entry *entry = &dns_table[idx];
795 (u16_t)(entry->server_idx), entry->name));
796 LWIP_ASSERT("dns server out of array", entry->server_idx < DNS_MAX_SERVERS);
797 if (ip_addr_isany_val(dns_servers[entry->server_idx])
799 && !entry->is_mdns
805 /* flush this entry */
806 entry->state = DNS_STATE_UNUSED;
814 (u16_t)(sizeof(udp_data) + SIZEOF_DNS_HDR + strlen(entry->name) + 2 + SIZEOF_DNS_QUERY), PBUF_RAM);
816 p = pbuf_alloc(PBUF_TRANSPORT, (u16_t)(SIZEOF_DNS_HDR + strlen(entry->name) + 2 + SIZEOF_DNS_QUERY), PBUF_RAM);
819 p = pbuf_alloc(PBUF_TRANSPORT, (u16_t)(SIZEOF_DNS_HDR + strlen(entry->name) + 2 +
828 hdr.id = lwip_htons(entry->txid);
835 dst = &dns_servers[entry->server_idx];
853 hostname = entry->name;
885 if (LWIP_DNS_ADDRTYPE_IS_IPV6(entry->reqaddrtype)) {
894 pcb_idx = entry->pcb_idx;
900 entry->txid, entry->name, entry->server_idx));
902 if (entry->is_mdns) {
905 if (LWIP_DNS_ADDRTYPE_IS_IPV6(entry->reqaddrtype)) {
921 dst = &dns_servers[entry->server_idx];
1031 * @param idx dns table index of the entry that is resolved or removed
1043 /* check that address type matches the request and adapt the table entry */
1058 /* flush this entry */
1131 * dns_check_entry() - see if entry has not yet been queried and, if so, sends out a query.
1132 * Check an entry in the dns_table:
1137 * @param i index of the dns_table entry to check
1143 struct dns_table_entry *entry = &dns_table[i];
1147 switch (entry->state) {
1149 /* initialize new entry */
1150 entry->txid = dns_create_txid();
1151 entry->state = DNS_STATE_ASKING;
1152 entry->server_idx = 0;
1153 entry->tmr = 1;
1154 entry->retries = 0;
1156 /* send DNS packet for this entry */
1164 if (--entry->tmr == 0) {
1165 if (++entry->retries == DNS_MAX_RETRIES) {
1166 if (dns_backupserver_available(entry)
1168 && !entry->is_mdns
1172 entry->server_idx++;
1173 entry->tmr = 1;
1174 entry->retries = 0;
1176 LWIP_DEBUGF(DNS_DEBUG, ("dns_check_entry: \"%s\": timeout\n", entry->name));
1179 /* flush this entry */
1180 entry->state = DNS_STATE_UNUSED;
1185 entry->tmr = entry->retries;
1188 /* send DNS packet for this entry */
1198 if ((entry->ttl == 0) || (--entry->ttl == 0)) {
1199 LWIP_DEBUGF(DNS_DEBUG, ("dns_check_entry: \"%s\": flush\n", entry->name));
1200 /* flush this entry, there cannot be any related pending entries in this state */
1201 entry->state = DNS_STATE_UNUSED;
1208 LWIP_ASSERT("unknown dns_table entry state:", 0);
1214 * Call dns_check_entry for each entry in dns_table - check all entries.
1232 struct dns_table_entry *entry = &dns_table[idx];
1234 entry->state = DNS_STATE_DONE;
1236 LWIP_DEBUGF(DNS_DEBUG, ("dns_recv: \"%s\": response = ", entry->name));
1237 ip_addr_debug_print_val(DNS_DEBUG, entry->ipaddr);
1241 entry->ttl = ttl;
1242 if (entry->ttl > DNS_MAX_TTL) {
1243 entry->ttl = DNS_MAX_TTL;
1245 dns_call_found(idx, &entry->ipaddr);
1247 if (entry->ttl == 0) {
1251 -> flush this entry now */
1252 /* entry reused during callback? */
1253 if (entry->state == DNS_STATE_DONE) {
1254 entry->state = DNS_STATE_UNUSED;
1289 struct dns_table_entry *entry = &dns_table[i];
1290 if ((entry->state == DNS_STATE_ASKING) &&
1291 (entry->txid == txid)) {
1300 LWIP_DEBUGF(DNS_DEBUG, ("dns_recv: \"%s\": not a response\n", entry->name));
1304 LWIP_DEBUGF(DNS_DEBUG, ("dns_recv: \"%s\": response not match to query\n", entry->name));
1309 if (!entry->is_mdns)
1327 if (!ip_addr_cmp(addr, &dns_servers[entry->server_idx])) {
1332 if (!ip_addr_cmp(addr, &dns_servers[entry->server_idx])) {
1338 /* Check if the name in the "question" part match with the name in the entry and
1340 res_idx = dns_compare_name(entry->name, p, SIZEOF_DNS_HDR);
1342 LWIP_DEBUGF(DNS_DEBUG, ("dns_recv: \"%s\": response not match to query\n", entry->name));
1351 (LWIP_DNS_ADDRTYPE_IS_IPV6(entry->reqaddrtype) && (qry.type != PP_HTONS(DNS_RRTYPE_AAAA))) ||
1352 (!LWIP_DNS_ADDRTYPE_IS_IPV6(entry->reqaddrtype) && (qry.type != PP_HTONS(DNS_RRTYPE_A)))) {
1353 LWIP_DEBUGF(DNS_DEBUG, ("dns_recv: \"%s\": response not match to query\n", entry->name));
1364 LWIP_DEBUGF(DNS_DEBUG, ("dns_recv: \"%s\": error in flags\n", entry->name));
1369 if (dns_backupserver_available(entry)) {
1371 entry->retries = DNS_MAX_RETRIES-1;
1372 entry->tmr = 1;
1374 /* contact next available server for this entry */
1400 if (!LWIP_DNS_ADDRTYPE_IS_IPV6(entry->reqaddrtype))
1419 if (LWIP_DNS_ADDRTYPE_IS_IPV6(entry->reqaddrtype))
1445 if ((entry->reqaddrtype == LWIP_DNS_ADDRTYPE_IPV4_IPV6) ||
1446 (entry->reqaddrtype == LWIP_DNS_ADDRTYPE_IPV6_IPV4)) {
1447 if (entry->reqaddrtype == LWIP_DNS_ADDRTYPE_IPV4_IPV6) {
1460 LWIP_DEBUGF(DNS_DEBUG, ("dns_recv: \"%s\": error in response\n", entry->name));
1492 struct dns_table_entry *entry = NULL;
1510 /* this is a duplicate entry, find a free request entry */
1526 /* search an unused entry, or the oldest one */
1530 entry = &dns_table[i];
1531 /* is it an unused entry ? */
1532 if (entry->state == DNS_STATE_UNUSED) {
1535 /* check if this is the oldest completed entry */
1536 if (entry->state == DNS_STATE_DONE) {
1537 u8_t age = (u8_t)(dns_seqno - entry->seqno);
1545 /* if we don't have found an unused entry, use the oldest completed one */
1548 /* no entry can be used now, table is full */
1554 entry = &dns_table[i];
1559 /* find a free request entry */
1568 /* no request entry can be used now, table is full */
1574 /* in this configuration, the entry index is the same as the request index */
1578 /* use this entry */
1579 LWIP_DEBUGF(DNS_DEBUG, ("dns_enqueue: \"%s\": use DNS entry %"U16_F"\n", name, (u16_t)(i)));
1581 /* fill the entry */
1582 entry->state = DNS_STATE_NEW;
1583 entry->seqno = dns_seqno;
1584 LWIP_DNS_SET_ADDRTYPE(entry->reqaddrtype, dns_addrtype);
1589 MEMCPY(entry->name, name, namelen);
1590 entry->name[namelen] = 0;
1593 entry->pcb_idx = dns_alloc_pcb();
1594 if (entry->pcb_idx >= DNS_MAX_SOURCE_PORTS) {
1597 entry->state = DNS_STATE_UNUSED;
1601 LWIP_DEBUGF(DNS_DEBUG, ("dns_enqueue: \"%s\": use DNS pcb %"U16_F"\n", name, (u16_t)(entry->pcb_idx)));
1605 entry->is_mdns = is_mdns;