fiche.h - fiche - A pastebin adjusted for gopher use
 (HTM) git clone git://vernunftzentrum.de/fiche.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
       fiche.h (2322B)
       ---
            1 /*
            2 Fiche - Command line pastebin for sharing terminal output.
            3 
            4 -------------------------------------------------------------------------------
            5 
            6 License: MIT (http://www.opensource.org/licenses/mit-license.php)
            7 Repository: https://github.com/solusipse/fiche/
            8 Live example: http://termbin.com
            9 
           10 -------------------------------------------------------------------------------
           11 
           12 usage: fiche [-DepbsdolBuw].
           13              [-D] [-e] [-d domain] [-p port] [-s slug size]
           14              [-o output directory] [-B buffer size] [-u user name]
           15              [-l log file] [-b banlist] [-w whitelist]
           16 
           17 Use netcat to push text - example:
           18 $ cat fiche.c | nc localhost 9999
           19 
           20 -------------------------------------------------------------------------------
           21 */
           22 
           23 #ifndef FICHE_H
           24 #define FICHE_H
           25 
           26 #include <stdint.h>
           27 #include <stdbool.h>
           28 
           29 
           30 /**
           31  * @brief Used as a container for fiche settings. Create before
           32  *        the initialization
           33  *
           34  */
           35 typedef struct Fiche_Settings {
           36     /**
           37      * @brief Domain used in output links
           38      */
           39     char *domain;
           40 
           41     /**
           42      * @brief Path to directory used for storing uploaded pastes
           43      */
           44     char *output_dir_path;
           45 
           46     /**
           47      * @brief Port on which fiche is waiting for connections
           48      */
           49     uint16_t port;
           50 
           51     /**
           52      * @brief Length of a paste's name
           53      */
           54     uint8_t slug_len;
           55 
           56     /**
           57      * @brief Protocol prefix to use, defaults to "http://"
           58      */
           59     char *prefix;
           60 
           61     /**
           62      * @brief Connection buffer length
           63      *
           64      * @remarks Length of this buffer limits max size of uploaded files
           65      */
           66     uint32_t buffer_len;
           67 
           68     /**
           69      * @brief Name of the user that runs fiche process
           70      */
           71     char *user_name;
           72 
           73     /**
           74      * @brief Path to the log file
           75      */
           76     char *log_file_path;
           77 
           78     /**
           79      * @brief Path to the file with banned IPs
           80      */
           81     char *banlist_path;
           82 
           83     /**
           84      * @brief Path to the file with whitelisted IPs
           85      */
           86     char *whitelist_path;
           87 
           88 
           89 
           90 } Fiche_Settings;
           91 
           92 
           93 /**
           94  *  @brief Initializes Fiche_Settings instance
           95  */
           96 void fiche_init(Fiche_Settings *settings);
           97 
           98 
           99 /**
          100  *  @brief Runs fiche server
          101  *
          102  *  @return 0 if it was able to start, any other value otherwise
          103  */
          104 int fiche_run(Fiche_Settings settings);
          105 
          106 
          107 /**
          108  * @brief array of symbols used in slug generation
          109  * @remarks defined in fiche.c
          110  */
          111 extern const char *Fiche_Symbols;
          112 
          113 
          114 #endif