Use the new PP_HTONx macros
This commit is contained in:
parent
5e7c830745
commit
3fa77d67be
|
@ -100,7 +100,7 @@ static void chargen_thread(void *arg)
|
|||
LWIP_ASSERT("chargen_thread(): Socket create failed.", listenfd >= 0);
|
||||
memset(&chargen_saddr, 0, sizeof(chargen_saddr));
|
||||
chargen_saddr.sin_family = AF_INET;
|
||||
chargen_saddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
chargen_saddr.sin_addr.s_addr = PP_HTONL(INADDR_ANY);
|
||||
chargen_saddr.sin_port = htons(19); /* Chargen server port */
|
||||
|
||||
if (bind(listenfd, (struct sockaddr *) &chargen_saddr, sizeof(chargen_saddr)) == -1)
|
||||
|
|
|
@ -271,9 +271,9 @@ netbios_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr, u
|
|||
if (netif_default != NULL) {
|
||||
/* @todo: do we need to check answerRRs/authorityRRs/additionalRRs? */
|
||||
/* if the packet is a NetBIOS name query question */
|
||||
if (((ntohs(netbios_hdr->flags) & NETB_HFLAG_OPCODE) == NETB_HFLAG_OPCODE_NAME_QUERY) &&
|
||||
((ntohs(netbios_hdr->flags) & NETB_HFLAG_RESPONSE) == 0) &&
|
||||
(ntohs(netbios_hdr->questions) == 1)) {
|
||||
if (((netbios_hdr->flags & PP_NTOHS(NETB_HFLAG_OPCODE)) == PP_NTOHS(NETB_HFLAG_OPCODE_NAME_QUERY)) &&
|
||||
((netbios_hdr->flags & PP_NTOHS(NETB_HFLAG_RESPONSE)) == 0) &&
|
||||
(netbios_hdr->questions == PP_NTOHS(1))) {
|
||||
/* decode the NetBIOS name */
|
||||
netbios_name_decoding( (char*)(netbios_name_hdr->encname), netbios_name, sizeof(netbios_name));
|
||||
/* if the packet is for us */
|
||||
|
@ -287,12 +287,12 @@ netbios_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr, u
|
|||
|
||||
/* prepare NetBIOS header response */
|
||||
resp->resp_hdr.trans_id = netbios_hdr->trans_id;
|
||||
resp->resp_hdr.flags = htons(NETB_HFLAG_RESPONSE |
|
||||
resp->resp_hdr.flags = PP_HTONS(NETB_HFLAG_RESPONSE |
|
||||
NETB_HFLAG_OPCODE_NAME_QUERY |
|
||||
NETB_HFLAG_AUTHORATIVE |
|
||||
NETB_HFLAG_RECURS_DESIRED);
|
||||
resp->resp_hdr.questions = 0;
|
||||
resp->resp_hdr.answerRRs = htons(1);
|
||||
resp->resp_hdr.answerRRs = PP_HTONS(1);
|
||||
resp->resp_hdr.authorityRRs = 0;
|
||||
resp->resp_hdr.additionalRRs = 0;
|
||||
|
||||
|
@ -301,9 +301,9 @@ netbios_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr, u
|
|||
resp->resp_name.nametype = netbios_name_hdr->nametype;
|
||||
resp->resp_name.type = netbios_name_hdr->type;
|
||||
resp->resp_name.cls = netbios_name_hdr->cls;
|
||||
resp->resp_name.ttl = htonl(NETBIOS_NAME_TTL);
|
||||
resp->resp_name.datalen = htons(sizeof(resp->resp_name.flags)+sizeof(resp->resp_name.addr));
|
||||
resp->resp_name.flags = htons(NETB_NFLAG_NODETYPE_BNODE);
|
||||
resp->resp_name.ttl = PP_HTONL(NETBIOS_NAME_TTL);
|
||||
resp->resp_name.datalen = PP_HTONS(sizeof(resp->resp_name.flags)+sizeof(resp->resp_name.addr));
|
||||
resp->resp_name.flags = PP_HTONS(NETB_NFLAG_NODETYPE_BNODE);
|
||||
ip_addr_copy(resp->resp_name.addr, netif_default->ip_addr);
|
||||
|
||||
/* send the NetBIOS response */
|
||||
|
|
|
@ -129,7 +129,7 @@ rtp_send_packets( int sock, struct sockaddr_in* to)
|
|||
rtphdr = (struct rtp_hdr*)rtp_send_packet;
|
||||
rtphdr->version = RTP_VERSION;
|
||||
rtphdr->payloadtype = 0;
|
||||
rtphdr->ssrc = htonl(RTP_SSRC);
|
||||
rtphdr->ssrc = PP_HTONL(RTP_SSRC);
|
||||
rtphdr->timestamp = htonl(ntohl(rtphdr->timestamp) + RTP_TIMESTAMP_INCREMENT);
|
||||
|
||||
/* send RTP stream packets */
|
||||
|
@ -179,15 +179,15 @@ rtp_send_thread(void *arg)
|
|||
/* prepare local address */
|
||||
memset(&local, 0, sizeof(local));
|
||||
local.sin_family = AF_INET;
|
||||
local.sin_port = htons(INADDR_ANY);
|
||||
local.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
local.sin_port = PP_HTONS(INADDR_ANY);
|
||||
local.sin_addr.s_addr = PP_HTONL(INADDR_ANY);
|
||||
|
||||
/* bind to local address */
|
||||
if (bind(sock, (struct sockaddr *)&local, sizeof(local)) == 0) {
|
||||
/* prepare RTP stream address */
|
||||
memset(&to, 0, sizeof(to));
|
||||
to.sin_family = AF_INET;
|
||||
to.sin_port = htons(RTP_STREAM_PORT);
|
||||
to.sin_port = PP_HTONS(RTP_STREAM_PORT);
|
||||
to.sin_addr.s_addr = rtp_stream_address;
|
||||
|
||||
/* send RTP packets */
|
||||
|
@ -236,8 +236,8 @@ rtp_recv_thread(void *arg)
|
|||
/* prepare local address */
|
||||
memset(&local, 0, sizeof(local));
|
||||
local.sin_family = AF_INET;
|
||||
local.sin_port = htons(RTP_STREAM_PORT);
|
||||
local.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
local.sin_port = PP_HTONS(RTP_STREAM_PORT);
|
||||
local.sin_addr.s_addr = PP_HTONL(INADDR_ANY);
|
||||
|
||||
/* bind to local address */
|
||||
if (bind(sock, (struct sockaddr *)&local, sizeof(local)) == 0) {
|
||||
|
@ -247,7 +247,7 @@ rtp_recv_thread(void *arg)
|
|||
|
||||
/* prepare multicast "ip_mreq" struct */
|
||||
ipmreq.imr_multiaddr.s_addr = rtp_stream_address;
|
||||
ipmreq.imr_interface.s_addr = htonl(INADDR_ANY);
|
||||
ipmreq.imr_interface.s_addr = PP_HTONL(INADDR_ANY);
|
||||
|
||||
/* join multicast group */
|
||||
if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &ipmreq, sizeof(ipmreq)) == 0) {
|
||||
|
|
|
@ -374,8 +374,8 @@ sntp_request(void *arg)
|
|||
/* prepare local address */
|
||||
memset(&local, 0, sizeof(local));
|
||||
local.sin_family = AF_INET;
|
||||
local.sin_port = htons(INADDR_ANY);
|
||||
local.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
local.sin_port = PP_HTONS(INADDR_ANY);
|
||||
local.sin_addr.s_addr = PP_HTONL(INADDR_ANY);
|
||||
|
||||
/* bind to local address */
|
||||
if (lwip_bind(sock, (struct sockaddr *)&local, sizeof(local)) == 0) {
|
||||
|
@ -389,7 +389,7 @@ sntp_request(void *arg)
|
|||
/* prepare SNTP server address */
|
||||
memset(&to, 0, sizeof(to));
|
||||
to.sin_family = AF_INET;
|
||||
to.sin_port = htons(SNTP_PORT);
|
||||
to.sin_port = PP_HTONS(SNTP_PORT);
|
||||
inet_addr_from_ipaddr(&to.sin_addr, &sntp_server_address);
|
||||
|
||||
/* send SNTP request to server */
|
||||
|
|
|
@ -40,7 +40,7 @@ sockex_nonblocking_connect(void *arg)
|
|||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sin_len = sizeof(addr);
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(SOCK_TARGET_PORT);
|
||||
addr.sin_port = PP_HTONS(SOCK_TARGET_PORT);
|
||||
addr.sin_addr.s_addr = inet_addr(SOCK_TARGET_HOST);
|
||||
|
||||
/* first try blocking: */
|
||||
|
@ -238,7 +238,7 @@ sockex_testrecv(void *arg)
|
|||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sin_len = sizeof(addr);
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(SOCK_TARGET_PORT);
|
||||
addr.sin_port = PP_HTONS(SOCK_TARGET_PORT);
|
||||
addr.sin_addr.s_addr = inet_addr(SOCK_TARGET_HOST);
|
||||
|
||||
/* first try blocking: */
|
||||
|
@ -394,7 +394,7 @@ sockex_testtwoselects(void *arg)
|
|||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sin_len = sizeof(addr);
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(SOCK_TARGET_PORT);
|
||||
addr.sin_port = PP_HTONS(SOCK_TARGET_PORT);
|
||||
addr.sin_addr.s_addr = inet_addr(SOCK_TARGET_HOST);
|
||||
|
||||
/* create the sockets */
|
||||
|
|
Loading…
Reference in New Issue