Home | History | Annotate | Download | only in src

Lines Matching refs:cnt

100 		for(int cnt=0; cnt<nALGPort; cnt++)
102 IPACMDBG("%d: Proto[%d], port[%d]\n", cnt, pALGPorts[cnt].protocol, pALGPorts[cnt].port);
135 int cnt = 0;
159 for(cnt = 0; cnt < max_entries; cnt++)
161 if(cache[cnt].private_ip !=0)
164 nat_rule.private_ip = cache[cnt].private_ip;
165 nat_rule.target_ip = cache[cnt].target_ip;
166 nat_rule.target_port = cache[cnt].target_port;
167 nat_rule.private_port = cache[cnt].private_port;
168 nat_rule.public_port = cache[cnt].public_port;
169 nat_rule.protocol = cache[cnt].protocol;
171 if(ipa_nat_add_ipv4_rule(nat_table_hdl, &nat_rule, &cache[cnt].rule_hdl) < 0)
174 memset(&cache[cnt], 0, sizeof(cache[cnt]));
178 cache[cnt].enabled = true;
196 int cnt = 0;
201 for(cnt = 0; cnt < max_entries; cnt++)
203 cache[cnt].enabled = false;
236 int cnt = 0;
239 for(; cnt < max_entries; cnt++)
241 if(cache[cnt].private_ip == rule->private_ip &&
242 cache[cnt].target_ip == rule->target_ip &&
243 cache[cnt].private_port == rule->private_port &&
244 cache[cnt].target_port == rule->target_port &&
245 cache[cnt].protocol == rule->protocol)
259 int cnt = 0;
266 for(; cnt < max_entries; cnt++)
268 if(cache[cnt].private_ip == rule->private_ip &&
269 cache[cnt].target_ip == rule->target_ip &&
270 cache[cnt].private_port == rule->private_port &&
271 cache[cnt].target_port == rule->target_port &&
272 cache[cnt].protocol == rule->protocol)
275 if(cache[cnt].enabled == true)
277 if(ipa_nat_del_ipv4_rule(nat_table_hdl, cache[cnt].rule_hdl) < 0)
282 IPACMDBG_H("Deleted Nat entry(%d) Successfully\n", cnt);
286 IPACMDBG_H("Deleted Nat entry(%d) only from cache\n", cnt);
289 memset(&cache[cnt], 0, sizeof(cache[cnt]));
301 int cnt = 0;
328 for(; cnt < max_entries; cnt++)
330 if(cache[cnt].private_ip == 0 &&
331 cache[cnt].target_ip == 0 &&
332 cache[cnt].private_port == 0 &&
333 cache[cnt].target_port == 0 &&
334 cache[cnt].protocol == 0)
340 if(max_entries == cnt)
358 cache[cnt].enabled = false;
359 cache[cnt].rule_hdl = 0;
364 if(ipa_nat_add_ipv4_rule(nat_table_hdl, &nat_rule, &cache[cnt].rule_hdl) < 0)
370 cache[cnt].enabled = true;
373 cache[cnt].private_ip = rule->private_ip;
374 cache[cnt].target_ip = rule->target_ip;
375 cache[cnt].target_port = rule->target_port;
376 cache[cnt].private_port = rule->private_port;
377 cache[cnt].protocol = rule->protocol;
378 cache[cnt].timestamp = 0;
379 cache[cnt].public_port = rule->public_port;
380 cache[cnt].dst_nat = rule->dst_nat;
391 if(cache[cnt].enabled == true)
393 IPACMDBG_H("Added rule(%d) successfully\n", cnt);
397 IPACMDBG_H("Cached rule(%d) successfully\n", cnt);
533 int cnt;
537 for(cnt = 0; cnt < max_entries; cnt++)
540 if(cache[cnt].enabled == true &&
541 (cache[cnt].private_ip != cache[cnt].public_ip))
544 if(ipa_nat_query_timestamp(nat_table_hdl, cache[cnt].rule_hdl, &ts) < 0)
546 IPACMERR("unable to retrieve timeout for rule hanle: %d\n", cache[cnt].rule_hdl);
550 if(cache[cnt].timestamp == ts)
553 cache[cnt].timestamp, ts);
562 UpdateCTUdpTs(&cache[cnt], ts);
571 int cnt;
572 for(cnt = 0; cnt < nALGPort; cnt++)
574 if(proto == pALGPorts[cnt].protocol &&
575 port == pALGPorts[cnt].port)
586 int cnt;
588 for(cnt = 0; cnt < IPA_MAX_NUM_WIFI_CLIENTS; cnt++)
590 if(0 != PwrSaveIfs[cnt] &&
591 ip_addr == PwrSaveIfs[cnt])
602 int cnt;
612 for(cnt = 0; cnt < IPA_MAX_NUM_WIFI_CLIENTS; cnt++)
614 if(PwrSaveIfs[cnt] == client_lan_ip)
621 for(cnt = 0; cnt < IPA_MAX_NUM_WIFI_CLIENTS; cnt++)
623 if(PwrSaveIfs[cnt] == 0)
625 PwrSaveIfs[cnt] = client_lan_ip;
630 for(cnt = 0; cnt < max_entries; cnt++)
632 if(cache[cnt].private_ip == client_lan_ip &&
633 cache[cnt].enabled == true)
635 if(ipa_nat_del_ipv4_rule(nat_table_hdl, cache[cnt].rule_hdl) < 0)
641 cache[cnt].enabled = false;
642 cache[cnt].rule_hdl = 0;
651 int cnt;
662 for(cnt = 0; cnt < IPA_MAX_NUM_WIFI_CLIENTS; cnt++)
664 if(PwrSaveIfs[cnt] == client_lan_ip)
666 PwrSaveIfs[cnt] = 0;
671 for(cnt = 0; cnt < max_entries; cnt++)
673 IPACMDBG("cache (%d): enable %d, ip 0x%x\n", cnt, cache[cnt].enabled, cache[cnt].private_ip);
675 if(cache[cnt].private_ip == client_lan_ip &&
676 cache[cnt].enabled == false)
679 nat_rule.private_ip = cache[cnt].private_ip;
680 nat_rule.target_ip = cache[cnt].target_ip;
681 nat_rule.target_port = cache[cnt].target_port;
682 nat_rule.private_port = cache[cnt].private_port;
683 nat_rule.public_port = cache[cnt].public_port;
684 nat_rule.protocol = cache[cnt].protocol;
686 if(ipa_nat_add_ipv4_rule(nat_table_hdl, &nat_rule, &cache[cnt].rule_hdl) < 0)
689 cnt], 0, sizeof(cache[cnt]));
693 cache[cnt].enabled = true;
720 int cnt;
740 for(cnt=0; cnt<MAX_TEMP_ENTRIES; cnt++)
742 if(temp[cnt].private_ip == new_entry->private_ip &&
743 temp[cnt].target_ip == new_entry->target_ip &&
744 temp[cnt].private_port == new_entry->private_port &&
745 temp[cnt].target_port == new_entry->target_port &&
746 temp[cnt].protocol == new_entry->protocol)
753 for(cnt=0; cnt<MAX_TEMP_ENTRIES; cnt++)
755 if(temp[cnt].private_ip == 0 &&
756 temp[cnt].target_ip == 0)
758 memcpy(&temp[cnt], new_entry, sizeof(nat_table_entry));
770 int cnt;
778 for(cnt=0; cnt<MAX_TEMP_ENTRIES; cnt++)
780 if(temp[cnt].private_ip == entry->private_ip &&
781 temp[cnt].target_ip == entry->target_ip &&
782 temp[cnt].private_port == entry->private_port &&
783 temp[cnt].target_port == entry->target_port &&
784 temp[cnt].protocol == entry->protocol)
786 memset(&temp[cnt], 0, sizeof(nat_table_entry));
799 int cnt;
805 for(cnt=0; cnt<MAX_TEMP_ENTRIES; cnt++)
807 if(temp[cnt].private_ip == ip_addr ||
808 temp[cnt].target_ip == ip_addr)
812 if(temp[cnt].public_ip == pub_ip_addr)
816 temp[cnt].private_ip = temp[cnt].public_ip;
817 temp[cnt].private_port = temp[cnt].public_port;
819 iptodot("Private IP", temp[cnt].private_ip);
822 ret = AddEntry(&temp[cnt]);
830 memset(&temp[cnt], 0, sizeof(nat_table_entry));
839 int cnt, tmp = 0;
848 for(cnt = 0; cnt < IPA_MAX_NUM_WIFI_CLIENTS; cnt++)
850 if(PwrSaveIfs[cnt] == ip_addr)
852 PwrSaveIfs[cnt] = 0;
853 IPACMDBG("Remove %d power save entry\n", cnt);
858 for(cnt = 0; cnt < max_entries; cnt++)
860 if(cache[cnt].private_ip == ip_addr)
862 if(cache[cnt].enabled == true)
864 if(ipa_nat_del_ipv4_rule(nat_table_hdl, cache[cnt].rule_hdl) < 0)
872 cache[cnt].enabled = false;
876 IPACMDBG("won't delete the rule for entry %d, enabled %d\n",cnt, cache[cnt].enabled);
886 int cnt, tmp = curCnt;
896 for(cnt = 0; cnt < max_entries; cnt++)
898 if(cache[cnt].target_ip == ip_addr)
900 if(cache[cnt].enabled == true)
902 if(ipa_nat_del_ipv4_rule(nat_table_hdl, cache[cnt].rule_hdl) < 0)
909 memset(&cache[cnt], 0, sizeof(cache[cnt]));
920 int cnt;
934 for(cnt=0; cnt < max_entries; cnt++)
936 if(cache[cnt].private_ip == 0 &&
937 cache[cnt].target_ip == 0 &&
938 cache[cnt].private_port == 0 &&
939 cache[cnt].target_port == 0 &&
940 cache[cnt].protocol == 0)
946 if(max_entries == cnt)
953 cache[cnt].enabled = false;
954 cache[cnt].rule_hdl = 0;
955 cache[cnt].private_ip = rule->private_ip;
956 cache[cnt].target_ip = rule->target_ip;
957 cache[cnt].target_port = rule->target_port;
958 cache[cnt].private_port = rule->private_port;
959 cache[cnt].protocol = rule->protocol;
960 cache[cnt].timestamp = 0;
961 cache[cnt].public_port = rule->public_port;
962 cache[cnt].public_ip = rule->public_ip;
963 cache[cnt].dst_nat = rule->dst_nat;
974 IPACMDBG("Cached rule(%d) successfully\n", cnt);