LCOV - code coverage report
Current view: top level - ballet/http - fd_http_server_private.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 1 9 11.1 %
Date: 2024-11-13 11:58:15 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_ballet_http_fd_http_server_private_h
       2             : #define HEADER_fd_src_ballet_http_fd_http_server_private_h
       3             : 
       4             : #include "fd_http_server.h"
       5             : 
       6           3 : #define FD_HTTP_SERVER_MAGIC (0xF17EDA2CE50A11D0) /* FIREDANCER HTTP V0 */
       7             : 
       8           0 : #define FD_HTTP_SERVER_CONNECTION_STATE_READING        0
       9           0 : #define FD_HTTP_SERVER_CONNECTION_STATE_WRITING_HEADER 1
      10           0 : #define FD_HTTP_SERVER_CONNECTION_STATE_WRITING_BODY   2
      11             : 
      12           0 : #define FD_HTTP_SERVER_PONG_STATE_NONE    0
      13           0 : #define FD_HTTP_SERVER_PONG_STATE_WAITING 1
      14           0 : #define FD_HTTP_SERVER_PONG_STATE_WRITING 2
      15             : 
      16           0 : #define FD_HTTP_SERVER_SEND_FRAME_STATE_HEADER 0
      17           0 : #define FD_HTTP_SERVER_SEND_FRAME_STATE_DATA   1
      18             : 
      19             : struct fd_http_server_connection {
      20             :   int          state;
      21             : 
      22             :   int          upgrade_websocket;
      23             :   ulong        request_bytes_len;
      24             :   char const * sec_websocket_key;
      25             : 
      26             :   char * request_bytes;
      27             :   ulong  request_bytes_read;
      28             : 
      29             :   fd_http_server_response_t response;
      30             :   ulong response_bytes_written;
      31             : 
      32             :   /* The treap fields */
      33             :   ushort left;
      34             :   ushort right;
      35             :   ushort parent;
      36             :   ushort prio;
      37             :   ushort prev;
      38             :   ushort next;
      39             : 
      40             :   /* The memory for the request is placed at the end of the struct here...
      41             :   char request[ ]; */
      42             : };
      43             : 
      44             : struct fd_http_server_ws_frame {
      45             :   ulong off;
      46             :   ulong len;
      47             : };
      48             : 
      49             : typedef struct fd_http_server_ws_frame fd_http_server_ws_frame_t;
      50             : 
      51             : struct fd_http_server_ws_connection {
      52             :   int   pong_state;
      53             :   ulong pong_data_len;
      54             :   uchar pong_data[ 125 ];
      55             :   ulong pong_bytes_written;
      56             : 
      57             :   int     recv_started_msg;
      58             :   int     recv_last_opcode;
      59             :   ulong   recv_bytes_parsed;
      60             :   ulong   recv_bytes_read;
      61             :   uchar * recv_bytes;
      62             : 
      63             :   int                         send_frame_state;
      64             :   ulong                       send_frame_bytes_written;
      65             :   ulong                       send_frame_cnt;
      66             :   ulong                       send_frame_idx;
      67             :   fd_http_server_ws_frame_t * send_frames;
      68             : 
      69             :   /* The treap fields */
      70             :   ushort left;
      71             :   ushort right;
      72             :   ushort parent;
      73             :   ushort prio;
      74             :   ushort prev;
      75             :   ushort next;
      76             : };
      77             : 
      78             : struct fd_http_server_hcache_private {
      79             :   int   err; /* If there has been an error while printing */
      80             :   ulong off; /* Offset into the staging buffer */
      81             :   ulong len; /* Length of the staging buffer */
      82             : };
      83             : 
      84             : struct __attribute__((aligned(FD_HTTP_SERVER_ALIGN))) fd_http_server_private {
      85             : 
      86             :   int   socket_fd;
      87             : 
      88             :   uchar * oring;
      89             :   ulong   oring_sz;
      90             : 
      91             :   int   stage_err;
      92             :   ulong stage_off;
      93             :   ulong stage_len;
      94             : 
      95             :   ulong max_conns;
      96             :   ulong max_ws_conns;
      97             :   ulong max_request_len;
      98             :   ulong max_ws_recv_frame_len;
      99             :   ulong max_ws_send_frame_cnt;
     100             : 
     101             :   ulong evict_conn_id;
     102             :   ulong evict_ws_conn_id;
     103             : 
     104             :   void * callback_ctx;
     105             :   fd_http_server_callbacks_t callbacks;
     106             : 
     107             :   ulong magic;      /* ==FD_HTTP_SERVER_MAGIC */
     108             : 
     109             : 
     110             :   struct fd_http_server_connection *    conns;
     111             :   struct fd_http_server_ws_connection * ws_conns;
     112             :   struct pollfd *                       pollfds;
     113             : 
     114             :   void * conn_treap;
     115             :   void * ws_conn_treap;
     116             : 
     117             :   /* The memory for conns and pollfds is placed at the end of the struct
     118             :      here...
     119             : 
     120             :   struct fd_http_server_connection    conns[ ];
     121             :   struct fd_http_server_ws_connection ws_conns[ ];
     122             :   struct pollfd                       pollfds[ ]; */
     123             : };
     124             : 
     125             : #endif /* HEADER_fd_src_ballet_http_fd_http_server_private_h */

Generated by: LCOV version 1.14