"Fossies" - the Fresh Open Source Software Archive

Member "tin-2.4.1/include/nntplib.h" (12 Oct 2016, 8710 Bytes) of archive /linux/misc/tin-2.4.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "nntplib.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.4.0_vs_2.4.1.

    1 /*
    2  *  Project   : tin - a Usenet reader
    3  *  Module    : nntplib.h
    4  *  Author    : I.Lea
    5  *  Created   : 1991-04-01
    6  *  Updated   : 2016-01-03
    7  *  Notes     : nntp.h 1.5.11/1.6 with extensions for tin
    8  *
    9  * Copyright (c) 1991-2017 Iain Lea <iain@bricbrac.de>
   10  * All rights reserved.
   11  *
   12  * Redistribution and use in source and binary forms, with or without
   13  * modification, are permitted provided that the following conditions
   14  * are met:
   15  * 1. Redistributions of source code must retain the above copyright
   16  *    notice, this list of conditions and the following disclaimer.
   17  * 2. Redistributions in binary form must reproduce the above copyright
   18  *    notice, this list of conditions and the following disclaimer in the
   19  *    documentation and/or other materials provided with the distribution.
   20  * 4. The name of the author may not be used to endorse or promote
   21  *    products derived from this software without specific prior written
   22  *    permission.
   23  *
   24  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
   25  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   26  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
   28  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
   30  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   31  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
   32  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
   33  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   34  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   35  */
   36 
   37 
   38 #ifndef NNTPLIB_H
   39 #define NNTPLIB_H 1
   40 
   41 #ifndef NNTP_SERVER_FILE
   42 #   define NNTP_SERVER_FILE "/etc/nntpserver"
   43 #endif /* !NNTP_SERVER_FILE */
   44 
   45 #define NNTP_TCP_NAME   "nntp"
   46 #define NNTP_TCP_PORT   "119"
   47 
   48 /*
   49  * # times to try and reconnect to server after timeout
   50  */
   51 #define NNTP_TRY_RECONNECT      2
   52 
   53 /*
   54  * @(#)Header: nntp.h,v 1.81 92/03/12 02:08:31 sob Exp $
   55  *
   56  * First digit:
   57  *
   58  *  1xx  Informative message
   59  *  2xx  Command ok
   60  *  3xx  Command ok so far, continue
   61  *  4xx  Command was correct, but couldn't be performed
   62  *       for some specified reason.
   63  *  5xx  Command unimplemented, incorrect, or a
   64  *       program error has occurred.
   65  *
   66  * Second digit:
   67  *
   68  *  x0x  Connection, setup, miscellaneous
   69  *  x1x  Newsgroup selection
   70  *  x2x  Article selection
   71  *  x3x  Distribution
   72  *  x4x  Posting
   73  */
   74 #if 0 /* unused */
   75 #   define CHAR_INF     '1'
   76 #   define CHAR_OK      '2'
   77 #   define CHAR_CONT    '3'
   78 #   define CHAR_ERR     '4'
   79 #   define CHAR_FATAL   '5'
   80 #endif /* 0 */
   81 
   82 /* TODO: cleanup against RFC 2980, RFC 3977 */
   83 #define INF_HELP        100 /* Help text on way */
   84 #define INF_CAPABILITIES    101 /* Capability list follows */
   85 #define INF_DATE        111 /* yyyymmddhhmmss Server date and time */
   86 
   87 #define OK_CANPOST      200 /* Hello; you can post */
   88 #define OK_NOPOST       201 /* Hello; you can't post */
   89 #define OK_EXTENSIONS   202 /* extensions supported follow */
   90 #define OK_GOODBYE      205 /* Closing connection */
   91 #define OK_COMPRESS     206 /* Compression active */
   92 #define OK_GROUP        211 /* Group selected */
   93 #define OK_GROUPS       215 /* Newsgroups follow */
   94 #define OK_MOTD         215 /* News motd follows */
   95 
   96 #define OK_ARTICLE      220 /* Article (head & body) follows */
   97 #define OK_HEAD         221 /* Head follows */
   98 #define OK_BODY         222 /* Body follows */
   99 #define OK_NOTEXT       223 /* No text sent -- stat, next, last */
  100 #define OK_XOVER        224 /* .overview data follows */
  101 #define OK_HDR          225 /* headers follow */
  102 #define OK_NEWNEWS      230 /* New articles by message-id follow */
  103 #define OK_NEWGROUPS    231 /* New newsgroups follow */
  104 #define OK_XFERED       235 /* Article transferred successfully */
  105 #define OK_POSTED       240 /* Article posted successfully */
  106 #define OK_AUTHSYS      280 /* Authorization system ok */
  107 #define OK_AUTH         281 /* Authorization (user/pass) ok */
  108 #define OK_BIN          282 /* binary data follows */
  109 #define OK_LIST         282 /* list follows */
  110 #define OK_AUTH_SASL    283 /* authentication accepted (with success data) */
  111 
  112 #define CONT_XFER       335 /* Continue to send article */
  113 #define CONT_POST       340 /* Continue to post article */
  114 #define NEED_AUTHINFO   380 /* authorization is required */
  115 #define NEED_AUTHDATA   381 /* <type> authorization data required */
  116 #define NEED_AUTHDATA_SASL  383 /* continue with SASL exchange */
  117 
  118 #define ERR_GOODBYE     400 /* Have to hang up for some reason */
  119 #define ERR_STATE       401 /* The client must change the state of the connection */
  120 #define ERR_COMPRESS    403 /* Unable to activate compression */
  121 #define ERR_NOGROUP     411 /* No such newsgroup */
  122 #define ERR_NCING       412 /* Not currently in newsgroup */
  123 
  124 #define ERR_NOCRNT      420 /* No current article selected */
  125 #define ERR_NONEXT      421 /* No next article in this group */
  126 #define ERR_NOPREV      422 /* No previous article in this group */
  127 #define ERR_NOARTIG     423 /* No such article in this group */
  128 #define ERR_NOART       430 /* No such article at all */
  129 #define ERR_GOTIT       435 /* Already got that article, don't send */
  130 #define ERR_XFERFAIL    436 /* Transfer failed */
  131 #define ERR_XFERRJCT    437 /* Article rejected, don't resend */
  132 #define ERR_NOPOST      440 /* Posting not allowed */
  133 #define ERR_POSTFAIL    441 /* Posting failed */
  134 #define ERR_NOAUTH      480 /* authorization required for command */
  135 #define ERR_AUTHFAIL    481 /* Authentication failed/rejected */
  136 #define ERR_AUTHSEQ     482 /* Authentication commands issued out of sequence or SASL protocol error */
  137 #define ERR_ENCRYPT     483 /* encrpytion required */
  138 
  139 #define ERR_COMMAND     500 /* Command not recognized */
  140 #define ERR_CMDSYN      501 /* Command syntax error */
  141 #define ERR_ACCESS      502 /* Access to server denied */
  142 #define ERR_FAULT       503 /* Program fault, command not performed */
  143 #define ERR_MOTD        503 /* No news motd file */
  144 #define ERR_COMPRESS_ALG    503 /* Compression algorithm not supported */
  145 #define ERR_AUTHBAD     580 /* Authorization Failed */
  146 
  147 /*
  148  * RFC 977 defines this; don't change it.
  149  */
  150 #define NNTP_STRLEN     512
  151 /*
  152  * RFC 3977 3.1
  153  */
  154 #define NNTP_GRPLEN     497
  155 
  156 /*
  157  * OVERVIEW.FMT field types
  158  */
  159 enum f_type { OVER_T_ERROR, OVER_T_INT, OVER_T_STRING, OVER_T_FSTRING };
  160 
  161 /*
  162  * CAPABILITIES
  163  * remember to update init.c and nntplib.c:check_extensions() if you change
  164  * t_capabilities
  165  */
  166 enum extension_type { NONE, CAPABILITIES, BROKEN };
  167 
  168 enum sasl_types {
  169     SASL_NONE       = 0,
  170     SASL_PLAIN      = 1 << 0,
  171     SASL_CRAM_MD5   = 1 << 1,
  172     SASL_DIGEST_MD5 = 1 << 2,
  173     SASL_GSSAPI     = 1 << 3,
  174     SASL_EXTERNAL   = 1 << 4,
  175     SASL_OTP        = 1 << 5,
  176     SASL_NTLM       = 1 << 6,
  177     SASL_LOGIN      = 1 << 7
  178 };
  179 enum c_algorithms { COMPRESS_NONE, COMPRESS_DEFLATE };
  180 
  181 struct t_capabilities {
  182     enum extension_type type;       /* NONE, CAPABILITIES, BROKEN */
  183     unsigned int version;           /* CAPABILITIES version */
  184     t_bool mode_reader:1;           /* MODE-READER: "MODE READER" */
  185     t_bool reader:1;                /* READER: "ARTICLE", "BODY", "DATE", "GROUP", "LAST", "LISTGROUP", "NEWGROUPS", "NEXT" */
  186     t_bool post:1;                  /* POST */
  187     t_bool list_active:1;           /* LIST ACTIVE */
  188     t_bool list_active_times:1;     /* LIST ACTIVE.TIMES, optional */
  189     t_bool list_distrib_pats:1;     /* LIST DISTRIB.PATS, optional */
  190     t_bool list_headers:1;          /* LIST HEADERS */
  191     t_bool list_newsgroups:1;       /* LIST NEWSGROUPS */
  192     t_bool list_overview_fmt:1;     /* LIST OVERVIEW.FMT */
  193     t_bool list_motd:1;             /* LIST MOTD, "private" extension */
  194     t_bool list_subscriptions:1;    /* LIST SUBSCRIPTIONS, "private" extension, RFC 2980 */
  195     t_bool list_distributions:1;    /* LIST DISTRIBUTIONS, "private" extension, RFC 2980 */
  196     t_bool list_moderators:1;       /* LIST MODERATORS, "private" extension */
  197     t_bool list_counts:1;           /* LIST COUNTS, "private" extension */
  198     t_bool xpat:1;                  /* XPAT, "private" extension, RFC 2980 */
  199     t_bool hdr:1;                   /* HDR: "HDR", "LIST HEADERS" */
  200     const char *hdr_cmd;            /* [X]HDR */
  201     t_bool over:1;                  /* OVER: "OVER", "LIST OVERVIEW.FMT" */
  202     t_bool over_msgid:1;            /* OVER: "OVER mid" */
  203     const char *over_cmd;           /* [X]OVER */
  204     t_bool newnews:1;               /* NEWNEWS */
  205     char *implementation;           /* IMPLEMENTATION */
  206     t_bool starttls:1;              /* STARTTLS */
  207     t_bool authinfo_user:1;         /* AUTHINFO USER/PASS */
  208     t_bool authinfo_sasl:1;         /* AUTHINFO SASL */
  209     t_bool authinfo_state:1;        /* AUTHINFO not supported in curent state */
  210     enum sasl_types sasl;           /* SASL_NONE, SASL_PLAIN, SASL_CRAM_MD5, SASL_DIGEST_MD5, SASL_GSSAPI, SASL_EXTERNAL, SASL_OTP, SASL_NTLM, SASL_LOGIN */
  211     t_bool compress:1;              /* COMPRESS */
  212     enum c_algorithms compress_algorithm;   /* COMPRESS_NONE, COMPRESS_DEFLATE */
  213 #if 0
  214     t_bool streaming:1;             /* STREAMING: "MODE STREAM", "CHECK", "TAKETHIS" */
  215     t_bool ihave:1;                 /* IHAVE: "IHAVE" */
  216 #endif /* 0 */
  217     t_bool broken_listgroup:1;      /* LISTGROUP doesn't select newsgroup */
  218 };
  219 
  220 #endif /* !NNTPLIB_H */