Edit

kc3-lang/kc3/libkc3/facts_connection.h

Branch :

  • Show log

    Commit

  • Author : thodg Thomas de Grivel
    Date : 2026-01-27 22:33:04
    Hash : 0ce94a35
    Message : rework Facts wrappers, remove most by using Facts instead of Facts* with Result.

  • libkc3/facts_connection.h
  • /* kc3
     * Copyright from 2022 to 2026 kmx.io <contact@kmx.io>
     *
     * Permission is hereby granted to use this software granted the above
     * copyright notice and this permission paragraph are included in all
     * copies and substantial portions of this software.
     *
     * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
     * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
     * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
     * THIS SOFTWARE.
     */
    #ifndef LIBKC3_FACTS_CONNECTION_H
    #define LIBKC3_FACTS_CONNECTION_H
    
    #include "types.h"
    
    /* Stack-allocation compatible functions, call facts_connection_clean
       after use. */
    void                 facts_connection_clean (s_facts_connection *conn);
    s_facts_connection * facts_connection_init (s_facts_connection *conn,
                                                s_facts *facts,
                                                s64 sockfd,
                                                p_tls tls);
    
    /* Heap allocation functions, call facts_connection_delete after use. */
    s_facts_connection * facts_connection_new (s_facts *facts, s64 sockfd,
                                               p_tls tls);
    void                 facts_connection_delete (s_facts_connection *conn);
    
    /* Operators. */
    s_facts_connection * facts_connection_add (s_facts *facts, s64 sockfd,
                                                p_tls tls, bool is_server);
    bool                 facts_connection_remove (s_facts *facts,
                                                  s_facts_connection *conn);
    void                 facts_connections_close_all (s_facts *facts);
    
    /* Send to master. */
    s_facts_connection * facts_connection_get_master (s_facts *facts);
    
    #endif /* LIBKC3_FACTS_CONNECTION_H */