LCOV - code coverage report
Current view: top level - minipot/include - minipot_session.h (source / functions) Hit Total Coverage
Test: sentinel-minipot-2.3.0 Code Coverage Lines: 0 5 0.0 %
Date: 2022-11-27 17:36:11 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #ifndef _SENTINEL_MINIPOT_SESSION_H_
       2             : #define _SENTINEL_MINIPOT_SESSION_H_
       3             : 
       4             : #include <event.h>
       5             : #include <stdbool.h>
       6             : #include <minipot.h>
       7             : 
       8             : struct minipot_session {
       9             :         int fd;
      10             :         struct event *read_ev;
      11             :         char ip_addr[INET6_ADDRSTRLEN];
      12             : };
      13             : 
      14             : // Initializes an instance - allocates its resources.
      15           0 : void minipot_session_init(struct minipot_session *) __attribute__((nonnull));
      16             : 
      17             : // Deinitializes an instance - frees its resources.
      18           0 : void minipot_session_destroy(struct minipot_session *) __attribute__((nonnull));
      19             : 
      20             : // Accepts a new TCP connection. Adds session read event to a minipot event loop.
      21             : // Returns 0 if everything is OK otherwise -1. Marks this session instance as
      22             : // NOT available for accepting a new connection.
      23           0 : int minipot_session_accept(struct minipot_session *self, int accept_fd,
      24             :         struct event_base *ev_base, event_callback_fn read_cb, void *read_cb_arg)
      25             :         __attribute__((nonnull));
      26             : 
      27             : // Closes session TCP connection. Removes session read event from a minipot
      28             : // event loop. Marks this session instance as available for accepting a new
      29             : // connection.
      30           0 : void minipot_session_close(struct minipot_session *) __attribute__((nonnull));
      31             : 
      32             : // Returns true if a session is available for accepting a new connection and
      33             : // false otherwise.
      34           0 : bool minipot_session_is_available(struct minipot_session *)
      35             :         __attribute__((nonnull));
      36             : 
      37             : #endif

Generated by: LCOV version 1.16