Lines Matching defs:tei

110  * typedef int (ta_prepare_add)(struct ip_fw_chain *ch, struct tentry_info *tei,
115 * from @tei to minimize operations needed to be done under WLOCK.
123 * typedef int (ta_prepare_del)(struct ip_fw_chain *ch, struct tentry_info *tei,
135 * struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
139 * * @tei may have the following flags:
143 * copy real entry value from @tei
145 * entry updated: return 0, store 0 to @pnum, store old value in @tei,
146 * add TEI_FLAGS_UPDATED flag to @tei.
155 * struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
160 * entry deleted: return 0, set 1 to @pnum, store old value in @tei.
168 * struct tentry_info *tei, void *ta_buf);
178 * -find_tentry: finds entry specified by key @tei
386 static void tei_to_sockaddr_ent(struct tentry_info *tei, struct sockaddr *sa,
388 static int ta_prepare_add_radix(struct ip_fw_chain *ch, struct tentry_info *tei,
391 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
392 static int ta_prepare_del_radix(struct ip_fw_chain *ch, struct tentry_info *tei,
395 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
396 static void ta_flush_radix_entry(struct ip_fw_chain *ch, struct tentry_info *tei,
599 tei_to_sockaddr_ent(struct tentry_info *tei, struct sockaddr *sa,
611 mlen = tei->masklen;
613 if (tei->subtype == AF_INET) {
623 a4 = *((in_addr_t *)tei->paddr);
631 } else if (tei->subtype == AF_INET6) {
640 memcpy(&addr6->sin6_addr, tei->paddr, sizeof(struct in6_addr));
651 ta_prepare_add_radix(struct ip_fw_chain *ch, struct tentry_info *tei,
664 mlen = tei->masklen;
667 if (tei->subtype == AF_INET) {
679 } else if (tei->subtype == AF_INET6) {
695 tei_to_sockaddr_ent(tei, addr, mask, &set_mask);
705 ta_add_radix(void *ta_state, struct table_info *ti, struct tentry_info *tei,
717 /* Save current entry value from @tei */
718 if (tei->subtype == AF_INET) {
720 ((struct radix_addr_entry *)tb->ent_ptr)->value = tei->value;
723 ((struct radix_addr_xentry *)tb->ent_ptr)->value = tei->value;
729 if ((tei->flags & TEI_FLAGS_UPDATE) == 0)
732 if (tei->subtype == AF_INET)
738 *old_value = tei->value;
739 tei->value = value;
742 tei->flags |= TEI_FLAGS_UPDATED;
748 if ((tei->flags & TEI_FLAGS_DONTADD) != 0)
757 if (tei->subtype == AF_INET)
768 ta_prepare_del_radix(struct ip_fw_chain *ch, struct tentry_info *tei,
777 mlen = tei->masklen;
780 if (tei->subtype == AF_INET) {
787 } else if (tei->subtype == AF_INET6) {
797 tei_to_sockaddr_ent(tei, addr, mask, &set_mask);
806 ta_del_radix(void *ta_state, struct table_info *ti, struct tentry_info *tei,
817 if (tei->subtype == AF_INET)
827 /* Save entry value to @tei */
828 if (tei->subtype == AF_INET)
829 tei->value = ((struct radix_addr_entry *)rn)->value;
831 tei->value = ((struct radix_addr_xentry *)rn)->value;
835 if (tei->subtype == AF_INET)
845 ta_flush_radix_entry(struct ip_fw_chain *ch, struct tentry_info *tei,
971 static int tei_to_chash_ent(struct tentry_info *tei, struct chashentry *ent);
976 static int ta_prepare_add_chash(struct ip_fw_chain *ch, struct tentry_info *tei,
979 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
980 static int ta_prepare_del_chash(struct ip_fw_chain *ch, struct tentry_info *tei,
983 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
984 static void ta_flush_chash_entry(struct ip_fw_chain *ch, struct tentry_info *tei,
1418 tei_to_chash_ent(struct tentry_info *tei, struct chashentry *ent)
1426 mlen = tei->masklen;
1428 if (tei->subtype == AF_INET) {
1435 ent->a.a4 = ntohl(*((in_addr_t *)tei->paddr)) >> (32 - mlen);
1438 } else if (tei->subtype == AF_INET6) {
1445 memcpy(&ent->a.a6, tei->paddr, sizeof(struct in6_addr));
1463 struct tentry_info tei;
1470 memset(&tei, 0, sizeof(tei));
1473 tei.paddr = &tent->k.addr;
1474 tei.masklen = cfg->mask4;
1475 tei.subtype = AF_INET;
1477 if ((error = tei_to_chash_ent(&tei, &ent)) != 0)
1491 tei.paddr = &tent->k.addr6;
1492 tei.masklen = cfg->mask6;
1493 tei.subtype = AF_INET6;
1495 if ((error = tei_to_chash_ent(&tei, &ent)) != 0)
1532 ta_prepare_add_chash(struct ip_fw_chain *ch, struct tentry_info *tei,
1543 error = tei_to_chash_ent(tei, ent);
1554 ta_add_chash(void *ta_state, struct table_info *ti, struct tentry_info *tei,
1570 /* Read current value from @tei */
1571 ent->value = tei->value;
1574 if (tei->subtype == AF_INET) {
1575 if (tei->masklen != cfg->mask4)
1588 if (tei->masklen != cfg->mask6)
1602 if ((tei->flags & TEI_FLAGS_UPDATE) == 0)
1606 tmp->value = tei->value;
1607 tei->value = value;
1609 tei->flags |= TEI_FLAGS_UPDATED;
1612 if ((tei->flags & TEI_FLAGS_DONTADD) != 0)
1619 if (tei->subtype == AF_INET)
1629 ta_prepare_del_chash(struct ip_fw_chain *ch, struct tentry_info *tei,
1636 return (tei_to_chash_ent(tei, &tb->ent));
1640 ta_del_chash(void *ta_state, struct table_info *ti, struct tentry_info *tei,
1653 if (tei->subtype == AF_INET) {
1654 if (tei->masklen != cfg->mask4)
1666 tei->value = tmp->value;
1671 if (tei->masklen != cfg->mask6)
1682 tei->value = tmp->value;
1692 ta_flush_chash_entry(struct ip_fw_chain *ch, struct tentry_info *tei,
1950 static int ta_prepare_add_ifidx(struct ip_fw_chain *ch, struct tentry_info *tei,
1953 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
1954 static int ta_prepare_del_ifidx(struct ip_fw_chain *ch, struct tentry_info *tei,
1957 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
1959 struct tentry_info *tei, void *ta_buf);
2192 ta_prepare_add_ifidx(struct ip_fw_chain *ch, struct tentry_info *tei,
2202 ifname = (char *)tei->paddr;
2224 ta_add_ifidx(void *ta_state, struct table_info *ti, struct tentry_info *tei,
2236 ifname = (char *)tei->paddr;
2241 ife->value = tei->value;
2246 if ((tei->flags & TEI_FLAGS_UPDATE) == 0)
2249 /* Exchange values in @tmp and @tei */
2251 tmp->value = tei->value;
2252 tei->value = value;
2262 tei->flags |= TEI_FLAGS_UPDATED;
2267 if ((tei->flags & TEI_FLAGS_DONTADD) != 0)
2288 ta_prepare_del_ifidx(struct ip_fw_chain *ch, struct tentry_info *tei,
2297 ifname = (char *)tei->paddr;
2309 ta_del_ifidx(void *ta_state, struct table_info *ti, struct tentry_info *tei,
2320 ifname = (char *)tei->paddr;
2349 tei->value = ife->value;
2362 ta_flush_ifidx_entry(struct ip_fw_chain *ch, struct tentry_info *tei,
2656 struct tentry_info *tei, void *ta_buf);
2658 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
2660 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
2662 struct tentry_info *tei, void *ta_buf);
2777 ta_prepare_add_numarray(struct ip_fw_chain *ch, struct tentry_info *tei,
2784 tb->na.number = *((uint32_t *)tei->paddr);
2790 ta_add_numarray(void *ta_state, struct table_info *ti, struct tentry_info *tei,
2802 /* Read current value from @tei */
2803 tb->na.value = tei->value;
2808 if ((tei->flags & TEI_FLAGS_UPDATE) == 0)
2811 /* Exchange values between ri and @tei */
2813 ri->value = tei->value;
2814 tei->value = value;
2816 tei->flags |= TEI_FLAGS_UPDATED;
2821 if ((tei->flags & TEI_FLAGS_DONTADD) != 0)
2840 ta_del_numarray(void *ta_state, struct table_info *ti, struct tentry_info *tei,
2855 tei->value = ri->value;
2869 ta_flush_numarray_entry(struct ip_fw_chain *ch, struct tentry_info *tei,
3123 static int tei_to_fhash_ent(struct tentry_info *tei, struct fhashentry *ent);
3129 struct tentry_info *tei, void *ta_buf);
3131 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
3132 static int ta_prepare_del_fhash(struct ip_fw_chain *ch, struct tentry_info *tei,
3135 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
3136 static void ta_flush_fhash_entry(struct ip_fw_chain *ch, struct tentry_info *tei,
3395 tei_to_fhash_ent(struct tentry_info *tei, struct fhashentry *ent)
3405 tfe = (struct tflow_entry *)tei->paddr;
3407 ent->af = tei->subtype;
3412 if (tei->subtype == AF_INET) {
3419 } else if (tei->subtype == AF_INET6) {
3441 struct tentry_info tei;
3451 memset(&tei, 0, sizeof(tei));
3453 tei.paddr = &tent->k.flow;
3454 tei.subtype = tent->subtype;
3456 if ((error = tei_to_fhash_ent(&tei, ent)) != 0)
3462 if (tei.subtype == AF_INET)
3494 ta_prepare_add_fhash(struct ip_fw_chain *ch, struct tentry_info *tei,
3504 if (tei->subtype == AF_INET)
3506 else if (tei->subtype == AF_INET6)
3513 error = tei_to_fhash_ent(tei, ent);
3524 ta_add_fhash(void *ta_state, struct table_info *ti, struct tentry_info *tei,
3540 /* Read current value from @tei */
3541 ent->value = tei->value;
3546 if (tei->subtype == AF_INET)
3560 if ((tei->flags & TEI_FLAGS_UPDATE) == 0)
3563 /* Exchange values between tmp and @tei */
3565 tmp->value = tei->value;
3566 tei->value = value;
3568 tei->flags |= TEI_FLAGS_UPDATED;
3571 if ((tei->flags & TEI_FLAGS_DONTADD) != 0)
3586 ta_prepare_del_fhash(struct ip_fw_chain *ch, struct tentry_info *tei,
3593 return (tei_to_fhash_ent(tei, &tb->fe6.e));
3597 ta_del_fhash(void *ta_state, struct table_info *ti, struct tentry_info *tei,
3614 if (tei->subtype == AF_INET)
3625 tei->value = tmp->value;
3636 ta_flush_fhash_entry(struct ip_fw_chain *ch, struct tentry_info *tei,