home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / news / nn.tar / nn-6.5.1 / news.h < prev    next >
C/C++ Source or Header  |  1995-04-29  |  3KB  |  97 lines

  1. /*
  2.  *    (c) Copyright 1990, Kim Fabricius Storm.  All rights reserved.
  3.  *
  4.  *    Interface for decoding article headers.
  5.  */
  6.  
  7. #ifndef _NN_NEWS_H
  8. #define _NN_NEWS_H 1
  9.  
  10. struct news_header {
  11.  
  12.     int    ng_flag;    /* flags:            */
  13. #      define N_DIGEST 1    /*   article is part of a digest*/
  14. #      define N_MODERATED 2    /*   group is moderated        */
  15.  
  16.     off_t    ng_fpos;    /* position of article text    */
  17.     off_t    ng_lpos;    /* last text offset        */
  18.                 /* header lines:        */
  19.     char    *ng_from;    /*   from            */
  20.     char    *ng_name;    /*   senders name        */
  21.     char    *ng_subj;    /*   subject            */
  22.     char    *ng_groups;    /*   newsgroups            */
  23.     char    *ng_path;    /*   path            */
  24.     char    *ng_reply;    /*   reply-to            */
  25.     char    *ng_ident;    /*   message id            */
  26.     char    *ng_follow;    /*   followup to        */
  27.     char    *ng_ref;    /*   references            */
  28.     char    *ng_keyw;    /*   keywords            */
  29.     char    *ng_dist;    /*   distibution        */
  30.     char    *ng_org;    /*   organization        */
  31.     char    *ng_appr;    /*   approved            */
  32.     char    *ng_summ;    /*   summary            */
  33.     char    *ng_control;    /*   control            */
  34.     char    *ng_sender;    /*   sender            */
  35.  
  36.     char    *ng_xref;    /*   xref            */
  37.     char    *ng_date;    /*   date            */
  38.  
  39.     char    *ng_rdate;    /*   date-received (News 3)    */
  40.     char    *ng_bref;    /*   back-references (News 3)    */
  41.     char    *ng_origr;    /*   originator            */
  42.  
  43.     char    *ng_xlines;    /*   lines (from header)    */
  44.     int    ng_lines;    /*   lines (decoded)        */
  45.     char    *ng_comment;    /*   comment-to (rfmail)    */
  46. } news;
  47.  
  48.  
  49. /*
  50.  * digest article subheader
  51.  */
  52.  
  53. struct digest_header {
  54.     off_t    dg_hpos;    /* position of article header    */
  55.     off_t    dg_fpos;    /* position of article text    */
  56.     off_t    dg_lpos;    /* last text position        */
  57.                 /* header lines:        */
  58.     char    *dg_date;    /*   date            */
  59.     char    *dg_from;    /*   from            */
  60.     char    *dg_subj;    /*   subject            */
  61.     char    *dg_to;        /*   to                */
  62.  
  63.     int    dg_lines;    /*   lines (pseudo field)    */
  64. } digest;
  65.  
  66.  
  67. #define    NEWS_HEADER_BUFFER    2048
  68.  
  69. typedef char    news_header_buffer[NEWS_HEADER_BUFFER];
  70.  
  71.  
  72. FILE *open_news_article(/* header, modes [, buffer1 [, buffer2]] */);
  73.  
  74. /* modes */
  75.  
  76. #define    FILL_NEWS_HEADER    0x0001    /* parse first header -> buffer1 */
  77. #define    FILL_DIGEST_HEADER    0x0002    /* parse second header -> buffer[12] */
  78.  
  79.  
  80. #define    GET_ALL_FIELDS        0x0010    /* get all fields (otherwise only   */
  81.                     /* name, subj, groups, lines        */
  82.  
  83. #define    GET_DATE_ONLY        0x0020    /* get Date field            */
  84.  
  85. #define    FILL_OFFSETS        0x0080    /* fill ng_[hfl]pos */
  86.  
  87.  
  88. #define    DIGEST_CHECK        0x0100    /* set N_DIGEST if "digest" in subj */
  89.                     /* only valid with FILL_NEWS_HEADER */
  90. #define LAZY_BODY        0x0200    /* nntp: get body only for digests */
  91.  
  92.  
  93. #define    SKIP_HEADER        0x1000    /* position after (sub) header */
  94.  
  95.  
  96. #endif /* _NN_NEWS_H */
  97.