Statistics
| Branch: | Tag: | Revision:

mongoose / docs / c-api / net.h / struct_mg_connection.md @ 707b9ed2

History | View | Annotate | Download (2.92 KB)

1
---
2
title: "struct mg_connection"
3
decl_name: "struct mg_connection"
4
symbol_kind: "struct"
5
signature: |
6
  struct mg_connection {
7
    struct mg_connection *next, *prev; /* mg_mgr::active_connections linkage */
8
    struct mg_connection *listener;    /* Set only for accept()-ed connections */
9
    struct mg_mgr *mgr;                /* Pointer to containing manager */
10
  
11
    sock_t sock; /* Socket to the remote peer */
12
    int err;
13
    union socket_address sa; /* Remote peer address */
14
    size_t recv_mbuf_limit;  /* Max size of recv buffer */
15
    struct mbuf recv_mbuf;   /* Received data */
16
    struct mbuf send_mbuf;   /* Data scheduled for sending */
17
    time_t last_io_time;     /* Timestamp of the last socket IO */
18
    double ev_timer_time;    /* Timestamp of the future MG_EV_TIMER */
19
  #if MG_ENABLE_SSL
20
    void *ssl_if_data; /* SSL library data. */
21
  #endif
22
    mg_event_handler_t proto_handler; /* Protocol-specific event handler */
23
    void *proto_data;                 /* Protocol-specific data */
24
    void (*proto_data_destructor)(void *proto_data);
25
    mg_event_handler_t handler; /* Event handler function */
26
    void *user_data;            /* User-specific data */
27
    union {
28
      void *v;
29
      /*
30
       * the C standard is fussy about fitting function pointers into
31
       * void pointers, since some archs might have fat pointers for functions.
32
       */
33
      mg_event_handler_t f;
34
    } priv_1;
35
    void *priv_2;
36
    void *mgr_data; /* Implementation-specific event manager's data. */
37
    struct mg_iface *iface;
38
    unsigned long flags;
39
  /* Flags set by Mongoose */
40
  #define MG_F_LISTENING (1 << 0)          /* This connection is listening */
41
  #define MG_F_UDP (1 << 1)                /* This connection is UDP */
42
  #define MG_F_RESOLVING (1 << 2)          /* Waiting for async resolver */
43
  #define MG_F_CONNECTING (1 << 3)         /* connect() call in progress */
44
  #define MG_F_SSL (1 << 4)                /* SSL is enabled on the connection */
45
  #define MG_F_SSL_HANDSHAKE_DONE (1 << 5) /* SSL hanshake has completed */
46
  #define MG_F_WANT_READ (1 << 6)          /* SSL specific */
47
  #define MG_F_WANT_WRITE (1 << 7)         /* SSL specific */
48
  #define MG_F_IS_WEBSOCKET (1 << 8)       /* Websocket specific */
49
  
50
  /* Flags that are settable by user */
51
  #define MG_F_SEND_AND_CLOSE (1 << 10)       /* Push remaining data and close  */
52
  #define MG_F_CLOSE_IMMEDIATELY (1 << 11)    /* Disconnect */
53
  #define MG_F_WEBSOCKET_NO_DEFRAG (1 << 12)  /* Websocket specific */
54
  #define MG_F_DELETE_CHUNK (1 << 13)         /* HTTP specific */
55
  #define MG_F_ENABLE_BROADCAST (1 << 14)     /* Allow broadcast address usage */
56
  #define MG_F_TUN_DO_NOT_RECONNECT (1 << 15) /* Don't reconnect tunnel */
57
  
58
  #define MG_F_USER_1 (1 << 20) /* Flags left for application */
59
  #define MG_F_USER_2 (1 << 21)
60
  #define MG_F_USER_3 (1 << 22)
61
  #define MG_F_USER_4 (1 << 23)
62
  #define MG_F_USER_5 (1 << 24)
63
  #define MG_F_USER_6 (1 << 25)
64
  };
65
---
66

    
67
Mongoose connection. 
68