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,
600 tei_to_sockaddr_ent(struct tentry_info *tei, struct sockaddr *sa,
612 mlen = tei->masklen;
614 if (tei->subtype == AF_INET) {
624 a4 = *((in_addr_t *)tei->paddr);
632 } else if (tei->subtype == AF_INET6) {
641 memcpy(&addr6->sin6_addr, tei->paddr, sizeof(struct in6_addr));
652 ta_prepare_add_radix(struct ip_fw_chain *ch, struct tentry_info *tei,
665 mlen = tei->masklen;
668 if (tei->subtype == AF_INET) {
680 } else if (tei->subtype == AF_INET6) {
696 tei_to_sockaddr_ent(tei, addr, mask, &set_mask);
706 ta_add_radix(void *ta_state, struct table_info *ti, struct tentry_info *tei,
718 /* Save current entry value from @tei */
719 if (tei->subtype == AF_INET) {
721 ((struct radix_addr_entry *)tb->ent_ptr)->value = tei->value;
724 ((struct radix_addr_xentry *)tb->ent_ptr)->value = tei->value;
730 if ((tei->flags & TEI_FLAGS_UPDATE) == 0)
733 if (tei->subtype == AF_INET)
739 *old_value = tei->value;
740 tei->value = value;
743 tei->flags |= TEI_FLAGS_UPDATED;
749 if ((tei->flags & TEI_FLAGS_DONTADD) != 0)
758 if (tei->subtype == AF_INET)
769 ta_prepare_del_radix(struct ip_fw_chain *ch, struct tentry_info *tei,
778 mlen = tei->masklen;
781 if (tei->subtype == AF_INET) {
788 } else if (tei->subtype == AF_INET6) {
798 tei_to_sockaddr_ent(tei, addr, mask, &set_mask);
807 ta_del_radix(void *ta_state, struct table_info *ti, struct tentry_info *tei,
818 if (tei->subtype == AF_INET)
828 /* Save entry value to @tei */
829 if (tei->subtype == AF_INET)
830 tei->value = ((struct radix_addr_entry *)rn)->value;
832 tei->value = ((struct radix_addr_xentry *)rn)->value;
836 if (tei->subtype == AF_INET)
846 ta_flush_radix_entry(struct ip_fw_chain *ch, struct tentry_info *tei,
972 static int tei_to_chash_ent(struct tentry_info *tei, struct chashentry *ent);
977 static int ta_prepare_add_chash(struct ip_fw_chain *ch, struct tentry_info *tei,
980 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
981 static int ta_prepare_del_chash(struct ip_fw_chain *ch, struct tentry_info *tei,
984 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
985 static void ta_flush_chash_entry(struct ip_fw_chain *ch, struct tentry_info *tei,
1419 tei_to_chash_ent(struct tentry_info *tei, struct chashentry *ent)
1427 mlen = tei->masklen;
1429 if (tei->subtype == AF_INET) {
1436 ent->a.a4 = ntohl(*((in_addr_t *)tei->paddr)) >> (32 - mlen);
1439 } else if (tei->subtype == AF_INET6) {
1446 memcpy(&ent->a.a6, tei->paddr, sizeof(struct in6_addr));
1464 struct tentry_info tei;
1471 memset(&tei, 0, sizeof(tei));
1474 tei.paddr = &tent->k.addr;
1475 tei.masklen = cfg->mask4;
1476 tei.subtype = AF_INET;
1478 if ((error = tei_to_chash_ent(&tei, &ent)) != 0)
1492 tei.paddr = &tent->k.addr6;
1493 tei.masklen = cfg->mask6;
1494 tei.subtype = AF_INET6;
1496 if ((error = tei_to_chash_ent(&tei, &ent)) != 0)
1533 ta_prepare_add_chash(struct ip_fw_chain *ch, struct tentry_info *tei,
1544 error = tei_to_chash_ent(tei, ent);
1555 ta_add_chash(void *ta_state, struct table_info *ti, struct tentry_info *tei,
1571 /* Read current value from @tei */
1572 ent->value = tei->value;
1575 if (tei->subtype == AF_INET) {
1576 if (tei->masklen != cfg->mask4)
1589 if (tei->masklen != cfg->mask6)
1603 if ((tei->flags & TEI_FLAGS_UPDATE) == 0)
1607 tmp->value = tei->value;
1608 tei->value = value;
1610 tei->flags |= TEI_FLAGS_UPDATED;
1613 if ((tei->flags & TEI_FLAGS_DONTADD) != 0)
1620 if (tei->subtype == AF_INET)
1630 ta_prepare_del_chash(struct ip_fw_chain *ch, struct tentry_info *tei,
1637 return (tei_to_chash_ent(tei, &tb->ent));
1641 ta_del_chash(void *ta_state, struct table_info *ti, struct tentry_info *tei,
1654 if (tei->subtype == AF_INET) {
1655 if (tei->masklen != cfg->mask4)
1667 tei->value = tmp->value;
1672 if (tei->masklen != cfg->mask6)
1683 tei->value = tmp->value;
1693 ta_flush_chash_entry(struct ip_fw_chain *ch, struct tentry_info *tei,
1951 static int ta_prepare_add_ifidx(struct ip_fw_chain *ch, struct tentry_info *tei,
1954 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
1955 static int ta_prepare_del_ifidx(struct ip_fw_chain *ch, struct tentry_info *tei,
1958 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
1960 struct tentry_info *tei, void *ta_buf);
2193 ta_prepare_add_ifidx(struct ip_fw_chain *ch, struct tentry_info *tei,
2203 ifname = (char *)tei->paddr;
2225 ta_add_ifidx(void *ta_state, struct table_info *ti, struct tentry_info *tei,
2237 ifname = (char *)tei->paddr;
2242 ife->value = tei->value;
2247 if ((tei->flags & TEI_FLAGS_UPDATE) == 0)
2250 /* Exchange values in @tmp and @tei */
2252 tmp->value = tei->value;
2253 tei->value = value;
2263 tei->flags |= TEI_FLAGS_UPDATED;
2268 if ((tei->flags & TEI_FLAGS_DONTADD) != 0)
2289 ta_prepare_del_ifidx(struct ip_fw_chain *ch, struct tentry_info *tei,
2298 ifname = (char *)tei->paddr;
2310 ta_del_ifidx(void *ta_state, struct table_info *ti, struct tentry_info *tei,
2321 ifname = (char *)tei->paddr;
2350 tei->value = ife->value;
2363 ta_flush_ifidx_entry(struct ip_fw_chain *ch, struct tentry_info *tei,
2657 struct tentry_info *tei, void *ta_buf);
2659 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
2661 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
2663 struct tentry_info *tei, void *ta_buf);
2778 ta_prepare_add_numarray(struct ip_fw_chain *ch, struct tentry_info *tei,
2785 tb->na.number = *((uint32_t *)tei->paddr);
2791 ta_add_numarray(void *ta_state, struct table_info *ti, struct tentry_info *tei,
2803 /* Read current value from @tei */
2804 tb->na.value = tei->value;
2809 if ((tei->flags & TEI_FLAGS_UPDATE) == 0)
2812 /* Exchange values between ri and @tei */
2814 ri->value = tei->value;
2815 tei->value = value;
2817 tei->flags |= TEI_FLAGS_UPDATED;
2822 if ((tei->flags & TEI_FLAGS_DONTADD) != 0)
2841 ta_del_numarray(void *ta_state, struct table_info *ti, struct tentry_info *tei,
2856 tei->value = ri->value;
2870 ta_flush_numarray_entry(struct ip_fw_chain *ch, struct tentry_info *tei,
3124 static int tei_to_fhash_ent(struct tentry_info *tei, struct fhashentry *ent);
3130 struct tentry_info *tei, void *ta_buf);
3132 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
3133 static int ta_prepare_del_fhash(struct ip_fw_chain *ch, struct tentry_info *tei,
3136 struct tentry_info *tei, void *ta_buf, uint32_t *pnum);
3137 static void ta_flush_fhash_entry(struct ip_fw_chain *ch, struct tentry_info *tei,
3397 tei_to_fhash_ent(struct tentry_info *tei, struct fhashentry *ent)
3407 tfe = (struct tflow_entry *)tei->paddr;
3409 ent->af = tei->subtype;
3414 if (tei->subtype == AF_INET) {
3421 } else if (tei->subtype == AF_INET6) {
3443 struct tentry_info tei;
3453 memset(&tei, 0, sizeof(tei));
3455 tei.paddr = &tent->k.flow;
3456 tei.subtype = tent->subtype;
3458 if ((error = tei_to_fhash_ent(&tei, ent)) != 0)
3464 if (tei.subtype == AF_INET)
3496 ta_prepare_add_fhash(struct ip_fw_chain *ch, struct tentry_info *tei,
3506 if (tei->subtype == AF_INET)
3508 else if (tei->subtype == AF_INET6)
3515 error = tei_to_fhash_ent(tei, ent);
3526 ta_add_fhash(void *ta_state, struct table_info *ti, struct tentry_info *tei,
3542 /* Read current value from @tei */
3543 ent->value = tei->value;
3548 if (tei->subtype == AF_INET)
3562 if ((tei->flags & TEI_FLAGS_UPDATE) == 0)
3565 /* Exchange values between tmp and @tei */
3567 tmp->value = tei->value;
3568 tei->value = value;
3570 tei->flags |= TEI_FLAGS_UPDATED;
3573 if ((tei->flags & TEI_FLAGS_DONTADD) != 0)
3588 ta_prepare_del_fhash(struct ip_fw_chain *ch, struct tentry_info *tei,
3595 return (tei_to_fhash_ent(tei, &tb->fe6.e));
3599 ta_del_fhash(void *ta_state, struct table_info *ti, struct tentry_info *tei,
3616 if (tei->subtype == AF_INET)
3627 tei->value = tmp->value;
3638 ta_flush_fhash_entry(struct ip_fw_chain *ch, struct tentry_info *tei,