Home
last modified time | relevance | path

Searched refs:htons (Results 1 – 25 of 83) sorted by relevance

1234

/xnu-8792.41.9/osfmk/i386/
H A Dendian.h62 #if !defined(htons)
63 unsigned short htons(unsigned short);
64 #define htons ntohs macro
91 #define HTONS(x) (x) = htons((unsigned short)x)
/xnu-8792.41.9/bsd/sys/
H A D_endian.h103 __uint16_t htons(__uint16_t);
113 #define htons(x) ((__uint16_t)(x))
134 #define htons(x) __DARWIN_OSSwapInt16(x)
140 #define htons(x) ((__uint16_t)__builtin_bswap16((__uint16_t)(x)))
160 #define HTONS(x) (x) = htons((__uint16_t)x)
/xnu-8792.41.9/bsd/net/
H A Dether_inet_pr_module.c194 if (eh->ether_type == htons(ETHERTYPE_IP)) { in ether_inet_input()
210 if (eh->ether_type == htons(ETHERTYPE_ARP)) { in ether_inet_input()
255 u_int16_t ethertype_ip = htons(ETHERTYPE_IP); in ether_inet_pre_output()
455 eh->ether_type = htons(ETHERTYPE_ARP); in ether_inet_arp()
458 ea->arp_pro = htons(ETHERTYPE_IP); in ether_inet_arp()
461 ea->arp_hrd = htons(ARPHRD_ETHER); in ether_inet_arp()
462 ea->arp_op = htons(arpop); in ether_inet_arp()
556 u_short en_native = htons(ETHERTYPE_IP); in ether_attach_inet()
557 u_short arp_native = htons(ETHERTYPE_ARP); in ether_attach_inet()
H A Dnat464_utils.c450 icmp4->icmp_nextmtu = htons((uint16_t)mtu); in nat464_translate_icmp()
514 ip4->ip_len = htons((uint16_t)(sizeof(*ip4) + tot_len2 - olen)); in nat464_translate_icmp_ip()
515 ip4->ip_id = rfc6864 ? 0 : htons(ip_randomid(ipid_salt)); in nat464_translate_icmp_ip()
516 ip4->ip_off = htons(IP_DF); in nat464_translate_icmp_ip()
540 ip6->ip6_plen = htons((uint16_t)(tot_len2 - olen)); in nat464_translate_icmp_ip()
611 p_ip6_frag->ip6f_offlg = htons(p_ip6_frag->ip6f_offlg); in nat464_insert_frag46()
616 p_ip6h->ip6_plen = htons(ntohs(p_ip6h->ip6_plen) + in nat464_insert_frag46()
671 ip4->ip_len = htons((uint16_t)(sizeof(*ip4) + (tot_len - off))); in nat464_translate_64()
686 ip4->ip_id = htons(ip4->ip_id); in nat464_translate_64()
690 ip4->ip_off = htons(ip_frag_off); in nat464_translate_64()
[all …]
H A Dether_inet6_pr_module.c117 if (ether_type == htons(ETHERTYPE_IPV6)) { in ether_inet6_input()
176 u_int16_t ethertype_ipv6 = htons(ETHERTYPE_IPV6); in ether_inet6_pre_output()
259 u_short en_6native = htons(ETHERTYPE_IPV6); in ether_attach_inet6()
H A Dpf_norm.c652 ip->ip_off = htons(ntohs(ip->ip_off) + (precut >> 3)); in pf_reassemble()
655 ip->ip_len = htons(ip_len); in pf_reassemble()
667 htons(ntohs(frea->fr_ip->ip_len) - aftercut); in pf_reassemble()
668 frea->fr_ip->ip_off = htons(ntohs(frea->fr_ip->ip_off) + in pf_reassemble()
775 ip->ip_len = htons(off + hlen); in pf_reassemble()
936 h->ip_off = htons(ntohs(h->ip_off) + in pf_fragcache()
938 h->ip_len = htons(ntohs(h->ip_len) - precut); in pf_fragcache()
995 h->ip_len = htons(ntohs(h->ip_len) - aftercut); in pf_fragcache()
1284 htons(ntohs(frent->fr_ip6f_opt.ip6f_offlg) + in pf_reassemble6()
1288 ip6->ip6_plen = htons(plen); in pf_reassemble6()
[all …]
H A Dbridgestp.c264 bpdu.cbu_rootpri = htons(bp->bp_desg_pv.pv_root_id >> 48); in bstp_transmit_bpdu()
269 bpdu.cbu_bridgepri = htons(bp->bp_desg_pv.pv_dbridge_id >> 48); in bstp_transmit_bpdu()
272 bpdu.cbu_portid = htons(bp->bp_port_id); in bstp_transmit_bpdu()
273 bpdu.cbu_messageage = htons(bp->bp_desg_msg_age); in bstp_transmit_bpdu()
274 bpdu.cbu_maxage = htons(bp->bp_desg_max_age); in bstp_transmit_bpdu()
275 bpdu.cbu_hellotime = htons(bp->bp_desg_htime); in bstp_transmit_bpdu()
276 bpdu.cbu_forwarddelay = htons(bp->bp_desg_fdelay); in bstp_transmit_bpdu()
323 eh->ether_type = htons(sizeof(bpdu)); in bstp_transmit_tcn()
435 bpdu->cbu_protoid = htons(BSTP_PROTO_ID); in bstp_send_bpdu()
444 eh->ether_type = htons(BSTP_BPDU_STP_LEN); in bstp_send_bpdu()
[all …]
/xnu-8792.41.9/osfmk/kdp/
H A Dkdp_udp.c572 ui->ui_len = htons((u_short)pkt.len + sizeof(struct kdp_udphdr)); in kdp_reply()
576 ui->ui_sport = htons(KDP_REMOTE_PORT); in kdp_reply()
586 ip->ip_len = htons((ushort_t)(sizeof(struct kdp_udpiphdr) + pkt.len)); in kdp_reply()
588 ip->ip_id = htons(ip_id++); in kdp_reply()
592 ip->ip_sum = htons(~ip_sum((unsigned char *)ip, ip->ip_hl)); in kdp_reply()
605 eh->ether_type = htons(ETHERTYPE_IP); in kdp_reply()
650 ui->ui_len = htons((u_short)pkt.len + sizeof(struct kdp_udphdr)); in kdp_send()
653 ui->ui_sport = htons(KDP_REMOTE_PORT); in kdp_send()
663 ip->ip_len = htons((ushort_t)(sizeof(struct kdp_udpiphdr) + pkt.len)); in kdp_send()
665 ip->ip_id = htons(ip_id++); in kdp_send()
[all …]
H A Dkdp_udp.h64 #define htons(x) OSSwapHostToBigInt16(x) macro
/xnu-8792.41.9/tests/
H A Dsocket_v4mappedv6.c35 local.sin6_port = htons(port);
42 remote.sin6_port = htons(port);
H A Daccept_race.c24 raddr.sin_port = htons(port); in client()
47 laddr.sin_port = htons(port); in server()
H A DIP6_EXTHDR_CHECK_61873584.c57 packet1.frag.ip6f_offlg = htons(0) | IP6F_MORE_FRAG;
73 packet2.frag.ip6f_offlg = htons(8);
H A Dicmp_fragmented_payload.c240 pcb->inner_tcp_hdr->th_sport = htons(tcp_in->th_sport); in icmp4_pcb_set_payload()
241 pcb->inner_tcp_hdr->th_dport = htons(tcp_in->th_dport); in icmp4_pcb_set_payload()
266 pcb->icmp_hdr->icmp_id = htons(pcb->id++); in icmp4_pcb_set_payload()
267 pcb->icmp_hdr->icmp_seq = htons(pcb->seq++); in icmp4_pcb_set_payload()
H A Din_cksum_test.c105 …T_ASSERT_EQ(osum, dsum, "checksum mismatch got 0x%04x expecting 0x%04x", htons(osum), htons(dsum)); in test_checksum()
H A Dsocket_bind_35685803.c45 sin.sin_port = htons(port); in sock_bind()
63 sin6.sin6_port = htons(port); in sockv6_bind()
H A Dv4mappedv6_recvpktinfo.c79 serveraddr.sin_port = htons((unsigned short)LISTENER_PORT); in listener_thread()
157 remote_addr.sin6_port = htons(LISTENER_PORT);
/xnu-8792.41.9/bsd/netinet6/
H A Dah_output.c284 ahdr->ah_reserve = htons(0); in ah4_output()
295 ahdr->ah_reserve = htons(0); in ah4_output()
324 ip->ip_len = htons(ntohs(ip->ip_len) + (u_int16_t)ahlen); in ah4_output()
463 ip6->ip6_plen = htons((u_int16_t)(m->m_pkthdr.len - sizeof(struct ip6_hdr))); in ah6_output()
496 ahdr->ah_reserve = htons(0); in ah6_output()
508 ahdr->ah_reserve = htons(0); in ah6_output()
H A Desp_output.c489 if (sav->remote_ike_port == htons(udp->uh_dport)) { in esp_output()
549 ip->ip_len = htons(ntohs(ip->ip_len) + (u_short)esphlen); in esp_output()
715 udp->uh_sport = htons((u_short)esp_udp_encap_port); in esp_output()
717 udp->uh_dport = htons(sav->remote_ike_port); in esp_output()
739 ip->ip_len = htons(ntohs(ip->ip_len) + (u_short)extendsiz); in esp_output()
871 ip->ip_len = htons(ntohs(ip->ip_len) + (u_short)siz); in esp_output()
894 udp->uh_ulen = htons((u_int16_t)(ntohs(ip->ip_len) - (IP_VHL_HL(ip->ip_vhl) << 2))); in esp_output()
899 udp->uh_ulen = htons((u_int16_t)(plen + siz + extendsiz + esphlen)); in esp_output()
H A Din6_ifattach.c855 if (ok && (in6->s6_addr16[0] != htons(0xfe80))) { in in6_ifattach_aliasreq()
862 in6->s6_addr16[1] = htons(ifp->if_index); in in6_ifattach_aliasreq()
883 ifra.ifra_addr.sin6_addr.s6_addr16[0] = htons(0xfe80); in in6_ifattach_aliasreq()
885 ifra.ifra_addr.sin6_addr.s6_addr16[1] = htons(ifp->if_index); in in6_ifattach_aliasreq()
978 ifra.ifra_addr.sin6_addr.s6_addr16[0] = htons(0xfe80); in in6_ifattach_llcgareq()
980 ifra.ifra_addr.sin6_addr.s6_addr16[1] = htons(ifp->if_index); in in6_ifattach_llcgareq()
1189 sin6.sin6_addr.s6_addr16[1] = htons(ifp->if_index); in in6_ifdetach()
H A Dah_input.c295 ip->ip_len = htons((u_int16_t)(ip->ip_len + hlen)); in ah4_input()
296 ip->ip_off = htons(ip->ip_off); in ah4_input()
405 ip->ip_sum = htons(~sum & 0xffff); in ah4_input()
510 ip->ip_len = htons(ntohs(ip->ip_len) - stripsiz); in ah4_input()
535 ip->ip_len = htons(ip->ip_len + hlen); in ah4_input()
536 ip->ip_off = htons(ip->ip_off); in ah4_input()
901 ip6->ip6_plen = htons((u_int16_t)(ntohs(ip6->ip6_plen) - stripsiz)); in ah6_input()
H A Dipsec.c2350 ip->ip_off &= htons(~IP_OFFMASK); in ipsec4_encapsulate()
2351 ip->ip_off &= htons(~IP_MF); in ipsec4_encapsulate()
2354 ip->ip_off &= htons(~IP_DF); in ipsec4_encapsulate()
2357 ip->ip_off |= htons(IP_DF); in ipsec4_encapsulate()
2364 ip->ip_len = htons((u_int16_t)(plen + sizeof(struct ip))); in ipsec4_encapsulate()
2442 ip6->ip6_plen = htons((u_int16_t)plen); in ipsec6_encapsulate()
2454 ip6->ip6_src.s6_addr16[1] = htons((u_int16_t)sav->sah->outgoing_if); in ipsec6_encapsulate()
2455 ip6->ip6_dst.s6_addr16[1] = htons((u_int16_t)sav->sah->outgoing_if); in ipsec6_encapsulate()
2532 ip->ip_len = htons((u_int16_t)(plen + sizeof(struct ip))); in ipsec64_encapsulate()
2534 ip->ip_len = htons((u_int16_t)plen); in ipsec64_encapsulate()
[all …]
H A Desp_input.c165 ip6->ip6_plen = htons(ntohs(ip6->ip6_plen) - stripsiz); in esp6_input_strip_udp_encap()
410 ip->ip_len = htons(ntohs(ip->ip_len) - siz); in esp4_input_extended()
520 ip->ip_len = htons(ntohs(ip->ip_len) - taillen); in esp4_input_extended()
594 ip->ip_sum = htons(~sum & 0xffff); in esp4_input_extended()
747 ip->ip_len = htons(ntohs(ip->ip_len) - stripsiz); in esp4_input_extended()
807 udp->uh_sport = htons(sav->remote_ike_port); in esp4_input_extended()
833 ip->ip_len = htons(ip->ip_len + hlen); in esp4_input_extended()
834 ip->ip_off = htons(ip->ip_off); in esp4_input_extended()
1115 ip6->ip6_plen = htons(ntohs(ip6->ip6_plen) - (u_int16_t)siz); in esp6_input_extended()
1223 ip6->ip6_plen = htons(ntohs(ip6->ip6_plen) - taillen); in esp6_input_extended()
[all …]
H A Dscope6.c248 sin6->sin6_addr.s6_addr16[1] = htons(zoneid & 0xffff); in sa6_embedscope()
446 in6->s6_addr16[1] = htons(zoneid & 0xffff); /* XXX */ in in6_setscope()
/xnu-8792.41.9/bsd/skywalk/nexus/flowswitch/
H A Dfsw_qos.c52 ip->ip_sum = fsw_qos_csum_fixup(ip->ip_sum, htons(old_tos), in fsw_qos_set_ip_tos()
53 htons(ip->ip_tos)); in fsw_qos_set_ip_tos()
/xnu-8792.41.9/bsd/net/classq/
H A Dclassq_util.c189 ip->ip_sum = htons(~sum & 0xffff); in write_dsfield()
280 ip->ip_sum = htons(~sum & 0xffff); in mark_ecn()

1234