LCOV - code coverage report
Current view: top level - include - sk-inet.h (source / functions) Hit Total Coverage
Test: coverage3.info Lines: 6 7 85.7 %
Date: 2014-04-22 Functions: 1 1 100.0 %
Branches: 1 2 50.0 %

           Branch data     Line data    Source code
       1                 :            : #ifndef __CR_SK_INET_H__
       2                 :            : #define __CR_SK_INET_H__
       3                 :            : 
       4                 :            : #include <netinet/tcp.h>
       5                 :            : 
       6                 :            : #include "sockets.h"
       7                 :            : #include "files.h"
       8                 :            : #include "list.h"
       9                 :            : #include "protobuf.h"
      10                 :            : #include "protobuf/sk-inet.pb-c.h"
      11                 :            : 
      12                 :            : #define INET_ADDR_LEN           40
      13                 :            : #ifndef TCP_REPAIR
      14                 :            : #define TCP_REPAIR              19      /* TCP sock is under repair right now */
      15                 :            : #define TCP_REPAIR_QUEUE        20
      16                 :            : #define TCP_QUEUE_SEQ           21
      17                 :            : #define TCP_REPAIR_OPTIONS      22
      18                 :            : #endif
      19                 :            : 
      20                 :            : struct inet_sk_desc {
      21                 :            :         struct socket_desc      sd;
      22                 :            :         unsigned int            type;
      23                 :            :         unsigned int            src_port;
      24                 :            :         unsigned int            dst_port;
      25                 :            :         unsigned int            state;
      26                 :            :         unsigned int            rqlen;
      27                 :            :         unsigned int            wqlen; /* sent + unsent data */
      28                 :            :         unsigned int            uwqlen; /* unsent data */
      29                 :            :         unsigned int            src_addr[4];
      30                 :            :         unsigned int            dst_addr[4];
      31                 :            :         unsigned short          shutdown;
      32                 :            : 
      33                 :            :         int rfd;
      34                 :            :         int cpt_reuseaddr;
      35                 :            :         struct list_head rlist;
      36                 :            : };
      37                 :            : 
      38                 :            : struct inet_port;
      39                 :            : struct inet_sk_info {
      40                 :            :         InetSkEntry *ie;
      41                 :            :         struct file_desc d;
      42                 :            :         struct inet_port *port;
      43                 :            :         struct list_head rlist;
      44                 :            : };
      45                 :            : 
      46                 :            : extern int inet_bind(int sk, struct inet_sk_info *);
      47                 :            : extern int inet_connect(int sk, struct inet_sk_info *);
      48                 :            : 
      49                 :            : struct rst_tcp_sock {
      50                 :            :         int     sk;
      51                 :            :         bool    reuseaddr;
      52                 :            : };
      53                 :            : 
      54                 :            : extern struct rst_tcp_sock *rst_tcp_socks;
      55                 :            : extern int rst_tcp_socks_nr;
      56                 :            : 
      57                 :            : static inline unsigned long rst_tcp_socks_len(void)
      58                 :            : {
      59                 :        718 :         return rst_tcp_socks_nr * sizeof(struct rst_tcp_sock);
      60                 :            : }
      61                 :            : 
      62                 :         24 : static inline void tcp_repair_off(int fd)
      63                 :            : {
      64                 :         24 :         int aux = 0, ret;
      65                 :            : 
      66                 :         24 :         ret = sys_setsockopt(fd, SOL_TCP, TCP_REPAIR, &aux, sizeof(aux));
      67         [ -  + ]:         24 :         if (ret < 0)
      68                 :          0 :                 pr_perror("Failed to turn off repair mode on socket (%d)", ret);
      69                 :         24 : }
      70                 :            : 
      71                 :            : extern void tcp_locked_conn_add(struct inet_sk_info *);
      72                 :            : extern void rst_unlock_tcp_connections(void);
      73                 :            : extern void cpt_unlock_tcp_connections(void);
      74                 :            : 
      75                 :            : extern int dump_one_tcp(int sk, struct inet_sk_desc *sd);
      76                 :            : extern int restore_one_tcp(int sk, struct inet_sk_info *si);
      77                 :            : 
      78                 :            : #define SK_EST_PARAM    "tcp-established"
      79                 :            : 
      80                 :            : extern int check_tcp(void);
      81                 :            : extern int rst_tcp_socks_add(int fd, bool reuseaddr);
      82                 :            : 
      83                 :            : #endif /* __CR_SK_INET_H__ */

Generated by: LCOV version 1.9