* 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
+22 -21
View File
@@ -7,6 +7,7 @@
#include <netinet/in_systm.h> #include <netinet/in_systm.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <stdint.h>
/* Based on RFC 791 */ /* Based on RFC 791 */
@@ -14,19 +15,19 @@
struct ip { struct ip {
#if BYTE_ORDER == BIG_ENDIAN #if BYTE_ORDER == BIG_ENDIAN
uint8 ip_v:4; uint8_t ip_v:4;
uint8 ip_hl:4; uint8_t ip_hl:4;
#elif BYTE_ORDER == LITTLE_ENDIAN #elif BYTE_ORDER == LITTLE_ENDIAN
uint8 ip_hl:4; uint8_t ip_hl:4;
uint8 ip_v:4; uint8_t ip_v:4;
#endif #endif
uint8 ip_tos; uint8_t ip_tos;
uint16 ip_len; uint16_t ip_len;
uint16 ip_id; uint16_t ip_id;
int16 ip_off; int16_t ip_off;
uint8 ip_ttl; uint8_t ip_ttl;
uint8 ip_p; uint8_t ip_p;
uint16 ip_sum; uint16_t ip_sum;
struct in_addr ip_src; struct in_addr ip_src;
struct in_addr ip_dst; struct in_addr ip_dst;
} _PACKED; } _PACKED;
@@ -69,15 +70,15 @@ struct ip {
#define IPOPT_MINOFF 4/* min value of above */ #define IPOPT_MINOFF 4/* min value of above */
struct ip_timestamp { struct ip_timestamp {
uint8 ipt_code;/* IPOPT_TS */ uint8_t ipt_code;/* IPOPT_TS */
uint8 ipt_len;/* size of structure (variable) */ uint8_t ipt_len;/* size of structure (variable) */
uint8 ipt_ptr;/* index of current entry */ uint8_t ipt_ptr;/* index of current entry */
#if BYTE_ORDER == BIG_ENDIAN #if BYTE_ORDER == BIG_ENDIAN
uint8 ipt_oflw:4, uint8_t ipt_oflw:4,
ipt_flg:4; ipt_flg:4;
#elif BYTE_ORDER == LITTLE_ENDIAN #elif BYTE_ORDER == LITTLE_ENDIAN
uint8 ipt_flg:4, uint8_t ipt_flg:4,
ipt_oflw:4; ipt_oflw:4;
#endif #endif
union ipt_timestamp { union ipt_timestamp {
n_time ipt_time[1]; n_time ipt_time[1];
@@ -112,9 +113,9 @@ struct ip_timestamp {
struct ippseudo { struct ippseudo {
struct in_addr ippseudo_src; /* source internet address */ struct in_addr ippseudo_src; /* source internet address */
struct in_addr ippseudo_dst; /* destination internet address */ struct in_addr ippseudo_dst; /* destination internet address */
uint8 ippseudo_pad;/* pad, must be zero */ uint8_t ippseudo_pad;/* pad, must be zero */
uint8 ippseudo_p;/* protocol */ uint8_t ippseudo_p;/* protocol */
uint16 ippseudo_len;/* protocol length */ uint16_t ippseudo_len;/* protocol length */
}; };
/* Fragment flags */ /* Fragment flags */
+6 -5
View File
@@ -40,19 +40,20 @@
#include <endian.h> #include <endian.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <stdint.h>
struct icmp { struct icmp {
uint8 icmp_type; uint8_t icmp_type;
uint8 icmp_code; uint8_t icmp_code;
uint16 icmp_cksum; uint16_t icmp_cksum;
union { union {
uint8 ih_pptr; uint8_t ih_pptr;
struct in_addr ih_gwaddr; struct in_addr ih_gwaddr;
struct ih_idseq { struct ih_idseq {
n_short icd_id; n_short icd_id;
n_short icd_seq; n_short icd_seq;
} ih_idseq; } ih_idseq;
int32 ih_void; int32_t ih_void;
/* ICMP_UNREACH_NEEDFRAG (RFC 1191) */ /* ICMP_UNREACH_NEEDFRAG (RFC 1191) */
struct ih_pmtu { struct ih_pmtu {
+51 -51
View File
@@ -45,9 +45,9 @@
struct ipovly { struct ipovly {
char * ih_next; char * ih_next;
char * ih_prev; char * ih_prev;
uint8 ih_x1; /* (unused) */ uint8_t ih_x1; /* (unused) */
uint8 ih_pr; /* protocol */ uint8_t ih_pr; /* protocol */
uint16 ih_len; /* protocol length */ uint16_t ih_len; /* protocol length */
struct in_addr ih_src; /* source internet address */ struct in_addr ih_src; /* source internet address */
struct in_addr ih_dst; /* destination internet address */ struct in_addr ih_dst; /* destination internet address */
}; };
@@ -62,7 +62,7 @@ struct ipovly {
struct ipoption { struct ipoption {
struct in_addr ipopt_dst; /* first-hop dst if source routed */ 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 ip_moptions {
struct ifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */ struct ifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */
uint8 imo_multicast_ttl; /* TTL for outgoing multicasts */ uint8_t imo_multicast_ttl; /* TTL for outgoing multicasts */
uint8 imo_multicast_loop; /* 1 => here sends if a member */ uint8_t imo_multicast_loop; /* 1 => here sends if a member */
uint16 imo_num_memberships; /* no. memberships this socket */ uint16_t imo_num_memberships; /* no. memberships this socket */
struct in_multi *imo_membership[IP_MAX_MEMBERSHIPS]; struct in_multi *imo_membership[IP_MAX_MEMBERSHIPS];
}; };
struct ipasfrag { struct ipasfrag {
#if B_HOST_IS_BENDIAN #if B_HOST_IS_BENDIAN
uint8 ip_v:4; uint8_t ip_v:4;
uint8 ip_hl:4; uint8_t ip_hl:4;
#else #else
uint8 ip_hl:4; uint8_t ip_hl:4;
uint8 ip_v:4; uint8_t ip_v:4;
#endif #endif
uint8 ipf_mff; uint8_t ipf_mff;
int16 ip_len; int16_t ip_len;
uint16 ip_id; uint16_t ip_id;
int16 ip_off; int16_t ip_off;
uint8 ip_ttl; uint8_t ip_ttl;
uint8 ip_p; uint8_t ip_p;
struct ipasfrag *ipf_next; struct ipasfrag *ipf_next;
struct ipasfrag *ipf_prev; struct ipasfrag *ipf_prev;
}; };
struct ipq { struct ipq {
struct ipq *next, *prev; struct ipq *next, *prev;
uint8 ipq_ttl; uint8_t ipq_ttl;
uint8 ipq_p; uint8_t ipq_p;
uint16 ipq_id; uint16_t ipq_id;
struct ipasfrag *ipq_next, *ipq_prev; struct ipasfrag *ipq_next, *ipq_prev;
struct in_addr ipq_src, ipq_dst; struct in_addr ipq_src, ipq_dst;
}; };
struct ipstat { struct ipstat {
int32 ips_total; /* total packets received */ int32_t ips_total; /* total packets received */
int32 ips_badsum; /* checksum bad */ int32_t ips_badsum; /* checksum bad */
int32 ips_tooshort; /* packet too short */ int32_t ips_tooshort; /* packet too short */
int32 ips_toosmall; /* not enough data */ int32_t ips_toosmall; /* not enough data */
int32 ips_badhlen; /* ip header length < data size */ int32_t ips_badhlen; /* ip header length < data size */
int32 ips_badlen; /* ip length < ip header length */ int32_t ips_badlen; /* ip length < ip header length */
int32 ips_fragments; /* fragments received */ int32_t ips_fragments; /* fragments received */
int32 ips_fragdropped; /* frags dropped (dups, out of space) */ int32_t ips_fragdropped; /* frags dropped (dups, out of space) */
int32 ips_fragtimeout; /* fragments timed out */ int32_t ips_fragtimeout; /* fragments timed out */
int32 ips_forward; /* packets forwarded */ int32_t ips_forward; /* packets forwarded */
int32 ips_cantforward; /* packets rcvd for unreachable dest */ int32_t ips_cantforward; /* packets rcvd for unreachable dest */
int32 ips_redirectsent; /* packets forwarded on same net */ int32_t ips_redirectsent; /* packets forwarded on same net */
int32 ips_noproto; /* unknown or unsupported protocol */ int32_t ips_noproto; /* unknown or unsupported protocol */
int32 ips_delivered; /* datagrams delivered to upper level*/ int32_t ips_delivered; /* datagrams delivered to upper level*/
int32 ips_localout; /* total ip packets generated here */ int32_t ips_localout; /* total ip packets generated here */
int32 ips_odropped; /* lost packets due to nobufs, etc. */ int32_t ips_odropped; /* lost packets due to nobufs, etc. */
int32 ips_reassembled; /* total packets reassembled ok */ int32_t ips_reassembled; /* total packets reassembled ok */
int32 ips_fragmented; /* datagrams sucessfully fragmented */ int32_t ips_fragmented; /* datagrams sucessfully fragmented */
int32 ips_ofragments; /* output fragments created */ int32_t ips_ofragments; /* output fragments created */
int32 ips_cantfrag; /* don't fragment flag was set, etc. */ int32_t ips_cantfrag; /* don't fragment flag was set, etc. */
int32 ips_badoptions; /* error in option processing */ int32_t ips_badoptions; /* error in option processing */
int32 ips_noroute; /* packets discarded due to no route */ int32_t ips_noroute; /* packets discarded due to no route */
int32 ips_badvers; /* ip version != 4 */ int32_t ips_badvers; /* ip version != 4 */
int32 ips_rawout; /* total raw ip packets generated */ int32_t ips_rawout; /* total raw ip packets generated */
int32 ips_badfrags; /* malformed fragments (bad length) */ int32_t ips_badfrags; /* malformed fragments (bad length) */
int32 ips_rcvmemdrop; /* frags dropped for lack of memory */ int32_t ips_rcvmemdrop; /* frags dropped for lack of memory */
int32 ips_toolong; /* ip length > max ip packet size */ int32_t ips_toolong; /* ip length > max ip packet size */
int32 ips_nogif; /* no match gif found */ int32_t ips_nogif; /* no match gif found */
int32 ips_badaddr; /* invalid address on header */ int32_t ips_badaddr; /* invalid address on header */
int32 ips_inhwcsum; /* hardware checksummed on input */ int32_t ips_inhwcsum; /* hardware checksummed on input */
int32 ips_outhwcsum; /* hardware checksummed on output */ int32_t ips_outhwcsum; /* hardware checksummed on output */
}; };
//#ifdef _KERNEL_MODE //#ifdef _KERNEL_MODE
+15 -13
View File
@@ -37,25 +37,27 @@
#ifndef NETINET_TCP_H #ifndef NETINET_TCP_H
#define NETINET_TCP_H #define NETINET_TCP_H
typedef uint32 tcp_seq; #include <stdint.h>
typedef uint32_t tcp_seq;
struct tcphdr { struct tcphdr {
uint16 th_sport; /* src port */ uint16_t th_sport; /* src port */
uint16 th_dport; /* dest. port */ uint16_t th_dport; /* dest. port */
tcp_seq th_seq; /* seq number */ tcp_seq th_seq; /* seq number */
tcp_seq th_ack; /* ack number */ tcp_seq th_ack; /* ack number */
#if B_HOST_IS_BENDIAN #if B_HOST_IS_BENDIAN
uint8 th_off:4, uint8_t th_off:4,
th_x2:4; th_x2:4;
#else #else
uint8 th_x2:4, /* unused */ uint8_t th_x2:4, /* unused */
th_off:4; /* data offset */ th_off:4; /* data offset */
#endif #endif
uint8 th_flags; /* ACK, FIN, PUSH, RST, SYN, URG */ uint8_t th_flags; /* ACK, FIN, PUSH, RST, SYN, URG */
uint16 th_win; /* advertised window */ uint16_t th_win; /* advertised window */
uint16 th_sum; /* checksum */ uint16_t th_sum; /* checksum */
uint16 th_urp; /* urgent offset */ uint16_t th_urp; /* urgent offset */
} _PACKED; } _PACKED;
#define TH_FIN 0x01 #define TH_FIN 0x01
+6 -4
View File
@@ -38,11 +38,13 @@
#ifndef NETINET_UDP_H #ifndef NETINET_UDP_H
#define NETINET_UDP_H #define NETINET_UDP_H
#include <stdint.h>
struct udphdr { struct udphdr {
uint16 uh_sport; uint16_t uh_sport;
uint16 uh_dport; uint16_t uh_dport;
uint16 uh_ulen; uint16_t uh_ulen;
uint16 uh_sum; uint16_t uh_sum;
}; };
#endif /* NETINET_UDP_H */ #endif /* NETINET_UDP_H */