[NETFILTER]: Add ctnetlink port for nf_conntrack
[powerpc.git] / include / linux / dccp.h
index add4908..088529f 100644 (file)
@@ -4,12 +4,6 @@
 #include <linux/types.h>
 #include <asm/byteorder.h>
 
-/* FIXME: this is utterly wrong */
-struct sockaddr_dccp {
-       struct sockaddr_in      in;
-       unsigned int            service;
-};
-
 /**
  * struct dccp_hdr - generic part of DCCP packet header
  *
@@ -182,6 +176,14 @@ enum {
        DCCPF_MAX_CCID_SPECIFIC = 255,
 };
 
+/* DCCP socket options */
+#define DCCP_SOCKOPT_PACKET_SIZE       1
+#define DCCP_SOCKOPT_SERVICE           2
+#define DCCP_SOCKOPT_CCID_RX_INFO      128
+#define DCCP_SOCKOPT_CCID_TX_INFO      192
+
+#define DCCP_SERVICE_LIST_MAX_LEN      32
+
 #ifdef __KERNEL__
 
 #include <linux/in.h>
@@ -190,9 +192,9 @@ enum {
 #include <linux/workqueue.h>
 
 #include <net/inet_connection_sock.h>
-#include <net/sock.h>
+#include <net/inet_sock.h>
+#include <net/inet_timewait_sock.h>
 #include <net/tcp_states.h>
-#include <net/tcp.h>
 
 enum dccp_state {
        DCCP_OPEN       = TCP_ESTABLISHED,
@@ -238,10 +240,15 @@ static inline struct dccp_hdr_ext *dccp_hdrx(const struct sk_buff *skb)
        return (struct dccp_hdr_ext *)(skb->h.raw + sizeof(struct dccp_hdr));
 }
 
+static inline unsigned int __dccp_basic_hdr_len(const struct dccp_hdr *dh)
+{
+       return sizeof(*dh) + (dh->dccph_x ? sizeof(struct dccp_hdr_ext) : 0);
+}
+
 static inline unsigned int dccp_basic_hdr_len(const struct sk_buff *skb)
 {
        const struct dccp_hdr *dh = dccp_hdr(skb);
-       return sizeof(*dh) + (dh->dccph_x ? sizeof(struct dccp_hdr_ext) : 0);
+       return __dccp_basic_hdr_len(dh);
 }
 
 static inline __u64 dccp_hdr_seq(const struct sk_buff *skb)
@@ -293,10 +300,15 @@ static inline struct dccp_hdr_reset *dccp_hdr_reset(struct sk_buff *skb)
        return (struct dccp_hdr_reset *)(skb->h.raw + dccp_basic_hdr_len(skb));
 }
 
+static inline unsigned int __dccp_hdr_len(const struct dccp_hdr *dh)
+{
+       return __dccp_basic_hdr_len(dh) +
+              dccp_packet_hdr_len(dh->dccph_type);
+}
+
 static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
 {
-       return dccp_basic_hdr_len(skb) +
-              dccp_packet_hdr_len(dccp_hdr(skb)->dccph_type);
+       return __dccp_hdr_len(dccp_hdr(skb));
 }
 
 
@@ -319,7 +331,8 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
   */
 struct dccp_options {
        __u64   dccpo_sequence_window;
-       __u8    dccpo_ccid;
+       __u8    dccpo_rx_ccid;
+       __u8    dccpo_tx_ccid;
        __u8    dccpo_send_ack_vector;
        __u8    dccpo_send_ndp_count;
 };
@@ -340,14 +353,10 @@ static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req)
        return (struct dccp_request_sock *)req;
 }
 
-/* Read about the ECN nonce to see why it is 253 */
-#define DCCP_MAX_ACK_VECTOR_LEN 253
+extern struct inet_timewait_death_row dccp_death_row;
 
 struct dccp_options_received {
-       u32     dccpor_ndp:24,
-               dccpor_ack_vector_len:8;
-       u32     dccpor_ack_vector_idx:10;
-       /* 22 bits hole, try to pack */
+       u32     dccpor_ndp; /* only 24 bits */
        u32     dccpor_timestamp;
        u32     dccpor_timestamp_echo;
        u32     dccpor_elapsed_time;
@@ -362,6 +371,27 @@ enum dccp_role {
        DCCP_ROLE_SERVER,
 };
 
+struct dccp_service_list {
+       __u32   dccpsl_nr;
+       __u32   dccpsl_list[0];
+};
+
+#define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1)
+
+static inline int dccp_list_has_service(const struct dccp_service_list *sl,
+                                       const u32 service)
+{
+       if (likely(sl != NULL)) {
+               u32 i = sl->dccpsl_nr;
+               while (i--)
+                       if (sl->dccpsl_list[i] == service)
+                               return 1; 
+       }
+       return 0;
+}
+
+struct dccp_ackvec;
+
 /**
  * struct dccp_sock - DCCP socket state
  *
@@ -377,12 +407,10 @@ enum dccp_role {
  * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss
  * @dccps_timestamp_time - time of latest TIMESTAMP option
  * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option
- * @dccps_ext_header_len - network protocol overhead (IP/IPv6 options)
- * @dccps_pmtu_cookie - Last pmtu seen by socket
- * @dccps_avg_packet_size - FIXME: has to be set by the app thru some setsockopt or ioctl, CCID3 uses it
+ * @dccps_packet_size - Set thru setsockopt
  * @dccps_role - Role of this sock, one of %dccp_role
  * @dccps_ndp_count - number of Non Data Packets since last data packet
- * @dccps_hc_rx_ackpkts - receiver half connection acked packets
+ * @dccps_hc_rx_ackvec - rx half connection ack vector
  */
 struct dccp_sock {
        /* inet_connection_sock has to be the first member of dccp_sock */
@@ -397,22 +425,24 @@ struct dccp_sock {
        __u64                           dccps_gss;
        __u64                           dccps_gsr;
        __u64                           dccps_gar;
-       unsigned long                   dccps_service;
-       unsigned long                   dccps_timestamp_time;
+       __u32                           dccps_service;
+       struct dccp_service_list        *dccps_service_list;
+       struct timeval                  dccps_timestamp_time;
        __u32                           dccps_timestamp_echo;
-       __u32                           dccps_avg_packet_size;
+       __u32                           dccps_packet_size;
        unsigned long                   dccps_ndp_count;
-       __u16                           dccps_ext_header_len;
-       __u32                           dccps_pmtu_cookie;
        __u32                           dccps_mss_cache;
        struct dccp_options             dccps_options;
-       struct dccp_ackpkts             *dccps_hc_rx_ackpkts;
+       struct dccp_ackvec              *dccps_hc_rx_ackvec;
        void                            *dccps_hc_rx_ccid_private;
        void                            *dccps_hc_tx_ccid_private;
        struct ccid                     *dccps_hc_rx_ccid;
        struct ccid                     *dccps_hc_tx_ccid;
        struct dccp_options_received    dccps_options_received;
+       struct timeval                  dccps_epoch;
        enum dccp_role                  dccps_role:2;
+       __u8                            dccps_hc_rx_insert_options:1;
+       __u8                            dccps_hc_tx_insert_options:1;
 };
  
 static inline struct dccp_sock *dccp_sk(const struct sock *sk)
@@ -420,6 +450,11 @@ static inline struct dccp_sock *dccp_sk(const struct sock *sk)
        return (struct dccp_sock *)sk;
 }
 
+static inline int dccp_service_not_initialized(const struct sock *sk)
+{
+       return dccp_sk(sk)->dccps_service == DCCP_SERVICE_INVALID_VALUE;
+}
+
 static inline const char *dccp_role(const struct sock *sk)
 {
        switch (dccp_sk(sk)->dccps_role) {