Lines Matching defs:th
169 static uint16_t checksum(void *th, uint16_t proto, size_t len)
184 return checksum_fold(th, len, sum);
258 struct tcphdr *th = _th;
260 th->source = htons(cfg_port_src);
261 th->dest = htons(cfg_port_dst);
262 th->doff = 5;
263 th->check = 0;
265 th->check = checksum(th, IPPROTO_TCP, sizeof(*th) + cfg_payload_len);
268 th->check = ~th->check;
270 fprintf(stderr, "tx: sending checksum: 0x%x\n", th->check);
271 return th + 1;
590 static int recv_verify_csum(void *th, int len, uint16_t sport, uint16_t csum_field)
594 csum = checksum(th, cfg_proto, len);
616 static int recv_verify_packet_tcp(void *th, int len)
618 struct tcphdr *tcph = th;
623 return recv_verify_csum(th, len, ntohs(tcph->source), tcph->check);
626 static int recv_verify_packet_udp_encap(void *th, int len)
628 struct udp_encap_hdr *eh = th;
636 static int recv_verify_packet_udp(void *th, int len)
638 struct udphdr *udph = th;
650 return recv_verify_csum(th, len, ntohs(udph->source), udph->check);