* Fixup some more headers, following axeld's lead with stdint.h (new_stack didn't compile for me without these).

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18010 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ithamar R. Adema 2006-07-03 03:27:04 +00:00
parent fb7cf8c43e
commit 62b4effa0a
5 changed files with 100 additions and 94 deletions

View File

@ -7,6 +7,7 @@
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <stdint.h>
/* Based on RFC 791 */
@ -14,19 +15,19 @@
struct ip {
#if BYTE_ORDER == BIG_ENDIAN
uint8 ip_v:4;
uint8 ip_hl:4;
uint8_t ip_v:4;
uint8_t ip_hl:4;
#elif BYTE_ORDER == LITTLE_ENDIAN
uint8 ip_hl:4;
uint8 ip_v:4;
uint8_t ip_hl:4;
uint8_t ip_v:4;
#endif
uint8 ip_tos;
uint16 ip_len;
uint16 ip_id;
int16 ip_off;
uint8 ip_ttl;
uint8 ip_p;
uint16 ip_sum;
uint8_t ip_tos;
uint16_t ip_len;
uint16_t ip_id;
int16_t ip_off;
uint8_t ip_ttl;
uint8_t ip_p;
uint16_t ip_sum;
struct in_addr ip_src;
struct in_addr ip_dst;
} _PACKED;
@ -69,15 +70,15 @@ struct ip {
#define IPOPT_MINOFF 4/* min value of above */
struct ip_timestamp {
uint8 ipt_code;/* IPOPT_TS */
uint8 ipt_len;/* size of structure (variable) */
uint8 ipt_ptr;/* index of current entry */
uint8_t ipt_code;/* IPOPT_TS */
uint8_t ipt_len;/* size of structure (variable) */
uint8_t ipt_ptr;/* index of current entry */
#if BYTE_ORDER == BIG_ENDIAN
uint8 ipt_oflw:4,
ipt_flg:4;
uint8_t ipt_oflw:4,
ipt_flg:4;
#elif BYTE_ORDER == LITTLE_ENDIAN
uint8 ipt_flg:4,
ipt_oflw:4;
uint8_t ipt_flg:4,
ipt_oflw:4;
#endif
union ipt_timestamp {
n_time ipt_time[1];
@ -112,9 +113,9 @@ struct ip_timestamp {
struct ippseudo {
struct in_addr ippseudo_src; /* source internet address */
struct in_addr ippseudo_dst; /* destination internet address */
uint8 ippseudo_pad;/* pad, must be zero */
uint8 ippseudo_p;/* protocol */
uint16 ippseudo_len;/* protocol length */
uint8_t ippseudo_pad;/* pad, must be zero */
uint8_t ippseudo_p;/* protocol */
uint16_t ippseudo_len;/* protocol length */
};
/* Fragment flags */

View File

@ -40,19 +40,20 @@
#include <endian.h>
#include <netinet/in.h>
#include <stdint.h>
struct icmp {
uint8 icmp_type;
uint8 icmp_code;
uint16 icmp_cksum;
uint8_t icmp_type;
uint8_t icmp_code;
uint16_t icmp_cksum;
union {
uint8 ih_pptr;
uint8_t ih_pptr;
struct in_addr ih_gwaddr;
struct ih_idseq {
n_short icd_id;
n_short icd_seq;
} ih_idseq;
int32 ih_void;
int32_t ih_void;
/* ICMP_UNREACH_NEEDFRAG (RFC 1191) */
struct ih_pmtu {

View File

@ -45,9 +45,9 @@
struct ipovly {
char * ih_next;
char * ih_prev;
uint8 ih_x1; /* (unused) */
uint8 ih_pr; /* protocol */
uint16 ih_len; /* protocol length */
uint8_t ih_x1; /* (unused) */
uint8_t ih_pr; /* protocol */
uint16_t ih_len; /* protocol length */
struct in_addr ih_src; /* source internet address */
struct in_addr ih_dst; /* destination internet address */
};
@ -62,7 +62,7 @@ struct ipovly {
struct ipoption {
struct in_addr ipopt_dst; /* first-hop dst if source routed */
int8 ipopt_list[MAX_IPOPTLEN]; /* options proper */
int8_t ipopt_list[MAX_IPOPTLEN]; /* options proper */
};
/*
@ -71,71 +71,71 @@ struct ipoption {
*/
struct ip_moptions {
struct ifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */
uint8 imo_multicast_ttl; /* TTL for outgoing multicasts */
uint8 imo_multicast_loop; /* 1 => here sends if a member */
uint16 imo_num_memberships; /* no. memberships this socket */
uint8_t imo_multicast_ttl; /* TTL for outgoing multicasts */
uint8_t imo_multicast_loop; /* 1 => here sends if a member */
uint16_t imo_num_memberships; /* no. memberships this socket */
struct in_multi *imo_membership[IP_MAX_MEMBERSHIPS];
};
struct ipasfrag {
#if B_HOST_IS_BENDIAN
uint8 ip_v:4;
uint8 ip_hl:4;
uint8_t ip_v:4;
uint8_t ip_hl:4;
#else
uint8 ip_hl:4;
uint8 ip_v:4;
uint8_t ip_hl:4;
uint8_t ip_v:4;
#endif
uint8 ipf_mff;
int16 ip_len;
uint16 ip_id;
int16 ip_off;
uint8 ip_ttl;
uint8 ip_p;
uint8_t ipf_mff;
int16_t ip_len;
uint16_t ip_id;
int16_t ip_off;
uint8_t ip_ttl;
uint8_t ip_p;
struct ipasfrag *ipf_next;
struct ipasfrag *ipf_prev;
};
struct ipq {
struct ipq *next, *prev;
uint8 ipq_ttl;
uint8 ipq_p;
uint16 ipq_id;
uint8_t ipq_ttl;
uint8_t ipq_p;
uint16_t ipq_id;
struct ipasfrag *ipq_next, *ipq_prev;
struct in_addr ipq_src, ipq_dst;
};
struct ipstat {
int32 ips_total; /* total packets received */
int32 ips_badsum; /* checksum bad */
int32 ips_tooshort; /* packet too short */
int32 ips_toosmall; /* not enough data */
int32 ips_badhlen; /* ip header length < data size */
int32 ips_badlen; /* ip length < ip header length */
int32 ips_fragments; /* fragments received */
int32 ips_fragdropped; /* frags dropped (dups, out of space) */
int32 ips_fragtimeout; /* fragments timed out */
int32 ips_forward; /* packets forwarded */
int32 ips_cantforward; /* packets rcvd for unreachable dest */
int32 ips_redirectsent; /* packets forwarded on same net */
int32 ips_noproto; /* unknown or unsupported protocol */
int32 ips_delivered; /* datagrams delivered to upper level*/
int32 ips_localout; /* total ip packets generated here */
int32 ips_odropped; /* lost packets due to nobufs, etc. */
int32 ips_reassembled; /* total packets reassembled ok */
int32 ips_fragmented; /* datagrams sucessfully fragmented */
int32 ips_ofragments; /* output fragments created */
int32 ips_cantfrag; /* don't fragment flag was set, etc. */
int32 ips_badoptions; /* error in option processing */
int32 ips_noroute; /* packets discarded due to no route */
int32 ips_badvers; /* ip version != 4 */
int32 ips_rawout; /* total raw ip packets generated */
int32 ips_badfrags; /* malformed fragments (bad length) */
int32 ips_rcvmemdrop; /* frags dropped for lack of memory */
int32 ips_toolong; /* ip length > max ip packet size */
int32 ips_nogif; /* no match gif found */
int32 ips_badaddr; /* invalid address on header */
int32 ips_inhwcsum; /* hardware checksummed on input */
int32 ips_outhwcsum; /* hardware checksummed on output */
int32_t ips_total; /* total packets received */
int32_t ips_badsum; /* checksum bad */
int32_t ips_tooshort; /* packet too short */
int32_t ips_toosmall; /* not enough data */
int32_t ips_badhlen; /* ip header length < data size */
int32_t ips_badlen; /* ip length < ip header length */
int32_t ips_fragments; /* fragments received */
int32_t ips_fragdropped; /* frags dropped (dups, out of space) */
int32_t ips_fragtimeout; /* fragments timed out */
int32_t ips_forward; /* packets forwarded */
int32_t ips_cantforward; /* packets rcvd for unreachable dest */
int32_t ips_redirectsent; /* packets forwarded on same net */
int32_t ips_noproto; /* unknown or unsupported protocol */
int32_t ips_delivered; /* datagrams delivered to upper level*/
int32_t ips_localout; /* total ip packets generated here */
int32_t ips_odropped; /* lost packets due to nobufs, etc. */
int32_t ips_reassembled; /* total packets reassembled ok */
int32_t ips_fragmented; /* datagrams sucessfully fragmented */
int32_t ips_ofragments; /* output fragments created */
int32_t ips_cantfrag; /* don't fragment flag was set, etc. */
int32_t ips_badoptions; /* error in option processing */
int32_t ips_noroute; /* packets discarded due to no route */
int32_t ips_badvers; /* ip version != 4 */
int32_t ips_rawout; /* total raw ip packets generated */
int32_t ips_badfrags; /* malformed fragments (bad length) */
int32_t ips_rcvmemdrop; /* frags dropped for lack of memory */
int32_t ips_toolong; /* ip length > max ip packet size */
int32_t ips_nogif; /* no match gif found */
int32_t ips_badaddr; /* invalid address on header */
int32_t ips_inhwcsum; /* hardware checksummed on input */
int32_t ips_outhwcsum; /* hardware checksummed on output */
};
//#ifdef _KERNEL_MODE

View File

@ -37,25 +37,27 @@
#ifndef NETINET_TCP_H
#define NETINET_TCP_H
typedef uint32 tcp_seq;
#include <stdint.h>
typedef uint32_t tcp_seq;
struct tcphdr {
uint16 th_sport; /* src port */
uint16 th_dport; /* dest. port */
tcp_seq th_seq; /* seq number */
tcp_seq th_ack; /* ack number */
uint16_t th_sport; /* src port */
uint16_t th_dport; /* dest. port */
tcp_seq th_seq; /* seq number */
tcp_seq th_ack; /* ack number */
#if B_HOST_IS_BENDIAN
uint8 th_off:4,
th_x2:4;
uint8_t th_off:4,
th_x2:4;
#else
uint8 th_x2:4, /* unused */
th_off:4; /* data offset */
uint8_t th_x2:4, /* unused */
th_off:4; /* data offset */
#endif
uint8 th_flags; /* ACK, FIN, PUSH, RST, SYN, URG */
uint16 th_win; /* advertised window */
uint16 th_sum; /* checksum */
uint16 th_urp; /* urgent offset */
uint8_t th_flags; /* ACK, FIN, PUSH, RST, SYN, URG */
uint16_t th_win; /* advertised window */
uint16_t th_sum; /* checksum */
uint16_t th_urp; /* urgent offset */
} _PACKED;
#define TH_FIN 0x01

View File

@ -38,11 +38,13 @@
#ifndef NETINET_UDP_H
#define NETINET_UDP_H
#include <stdint.h>
struct udphdr {
uint16 uh_sport;
uint16 uh_dport;
uint16 uh_ulen;
uint16 uh_sum;
uint16_t uh_sport;
uint16_t uh_dport;
uint16_t uh_ulen;
uint16_t uh_sum;
};
#endif /* NETINET_UDP_H */