]> err.no Git - linux-2.6/blobdiff - net/dccp/dccp.h
Merge master.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild
[linux-2.6] / net / dccp / dccp.h
index 53994f10ced515e8957959965c09b3e4f0f7f4a7..33456c0d5937c8950b1a525b7d156e63adc52077 100644 (file)
@@ -126,8 +126,8 @@ extern void dccp_send_delayed_ack(struct sock *sk);
 extern void dccp_send_sync(struct sock *sk, const u64 seq,
                           const enum dccp_pkt_type pkt_type);
 
-extern int dccp_write_xmit(struct sock *sk, struct sk_buff *skb,
-                          const int len);
+extern int dccp_write_xmit(struct sock *sk, struct sk_buff *skb, long *timeo);
+extern void dccp_write_space(struct sock *sk);
 
 extern void dccp_init_xmit_timers(struct sock *sk);
 static inline void dccp_clear_xmit_timers(struct sock *sk)
@@ -364,6 +364,8 @@ extern void dccp_insert_options(struct sock *sk, struct sk_buff *skb);
 extern void dccp_insert_option_elapsed_time(struct sock *sk,
                                            struct sk_buff *skb,
                                            u32 elapsed_time);
+extern void dccp_insert_option_timestamp(struct sock *sk,
+                                        struct sk_buff *skb);
 extern void dccp_insert_option(struct sock *sk, struct sk_buff *skb,
                               unsigned char option,
                               const void *value, unsigned char len);
@@ -428,17 +430,53 @@ extern int dccp_ackpkts_add(struct dccp_ackpkts *ap, u64 ackno, u8 state);
 extern void dccp_ackpkts_check_rcv_ackno(struct dccp_ackpkts *ap,
                                         struct sock *sk, u64 ackno);
 
+static inline suseconds_t timeval_usecs(const struct timeval *tv)
+{
+       return tv->tv_sec * USEC_PER_SEC + tv->tv_usec;
+}
+
+static inline suseconds_t timeval_delta(const struct timeval *large,
+                                       const struct timeval *small)
+{
+       time_t      secs  = large->tv_sec  - small->tv_sec;
+       suseconds_t usecs = large->tv_usec - small->tv_usec;
+
+       if (usecs < 0) {
+               secs--;
+               usecs += USEC_PER_SEC;
+       }
+       return secs * USEC_PER_SEC + usecs;
+}
+
+static inline void timeval_add_usecs(struct timeval *tv,
+                                    const suseconds_t usecs)
+{
+       tv->tv_usec += usecs;
+       while (tv->tv_usec >= USEC_PER_SEC) {
+               tv->tv_sec++;
+               tv->tv_usec -= USEC_PER_SEC;
+       }
+}
+
+static inline void timeval_sub_usecs(struct timeval *tv,
+                                    const suseconds_t usecs)
+{
+       tv->tv_usec -= usecs;
+       while (tv->tv_usec < 0) {
+               tv->tv_sec--;
+               tv->tv_usec += USEC_PER_SEC;
+       }
+}
+
 /*
  * Returns the difference in usecs between timeval
  * passed in and current time
  */
-static inline u32 now_delta(struct timeval tv)
+static inline suseconds_t timeval_now_delta(const struct timeval *tv)
 {
        struct timeval now;
-       
        do_gettimeofday(&now);
-       return (now.tv_sec  - tv.tv_sec) * USEC_PER_SEC +
-              (now.tv_usec - tv.tv_usec);
+       return timeval_delta(&now, tv);
 }
 
 #ifdef CONFIG_IP_DCCP_DEBUG