home *** CD-ROM | disk | FTP | other *** search
/ ftp.uv.es / 2014.11.ftp.uv.es.tar / ftp.uv.es / pub / unix / pine4.10.tar.gz / pine4.10.tar / pine4.10 / imap / src / c-client / nntp.h < prev    next >
Text File  |  1998-12-10  |  6KB  |  134 lines

  1. /*
  2.  * Program:    Network News Transfer Protocol (NNTP) routines
  3.  *
  4.  * Author:    Mark Crispin
  5.  *        Networks and Distributed Computing
  6.  *        Computing & Communications
  7.  *        University of Washington
  8.  *        Administration Building, AG-44
  9.  *        Seattle, WA  98195
  10.  *        Internet: MRC@CAC.Washington.EDU
  11.  *
  12.  * Date:    10 February 1992
  13.  * Last Edited:    9 December 1998
  14.  *
  15.  * Copyright 1998 by the University of Washington
  16.  *
  17.  *  Permission to use, copy, modify, and distribute this software and its
  18.  * documentation for any purpose and without fee is hereby granted, provided
  19.  * that the above copyright notices appear in all copies and that both the
  20.  * above copyright notices and this permission notice appear in supporting
  21.  * documentation, and that the name of the University of Washington not be
  22.  * used in advertising or publicity pertaining to distribution of the software
  23.  * without specific, written prior permission.  This software is made
  24.  * available "as is", and
  25.  * THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
  26.  * WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED
  27.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN
  28.  * NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL,
  29.  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
  30.  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT
  31.  * (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN
  32.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  33.  *
  34.  */
  35.  
  36. /* Constants */
  37.  
  38. #define MAXLOGINTRIALS 3    /* maximum number of login trials */
  39. #define NNTPTCPPORT (long) 119    /* assigned TCP contact port */
  40. #define NNTPGREET (long) 200    /* NNTP successful greeting */
  41. #define NNTPGREETNOPOST (long) 201
  42. #define NNTPGOK (long) 211    /* NNTP group selection OK */
  43. #define NNTPGLIST (long) 215    /* NNTP group list being returned */
  44. #define NNTPHEAD (long) 221    /* NNTP header text */
  45. #define NNTPBODY (long) 222    /* NNTP body text */
  46. #define NNTPOVER (long) 224    /* NNTP overview text */
  47. #define NNTPOK (long) 240    /* NNTP OK code */
  48. #define NNTPAUTHED (long) 281    /* NNTP successful authentication */
  49. #define NNTPREADY (long) 340    /* NNTP ready for data */
  50. #define NNTPWANTAUTH (long) 380    /* NNTP authentication needed */
  51. #define NNTPWANTPASS (long) 381    /* NNTP password needed */
  52. #define NNTPSOFTFATAL (long) 400/* NNTP soft fatal code */
  53. #define NNTPWANTAUTH2 (long) 480/* NNTP authentication needed (alternate) */
  54.  
  55.  
  56. /* NNTP I/O stream local data */
  57.     
  58. typedef struct nntp_local {
  59.   SENDSTREAM *nntpstream;    /* NNTP stream for I/O */
  60.   unsigned int dirty : 1;    /* disk copy of .newsrc needs updating */
  61.   char *host;            /* local host name */
  62.   char *name;            /* local newsgroup name */
  63.   char *user;            /* mailbox user */
  64.   unsigned long msgno;        /* current text message number */
  65.   FILE *txt;            /* current text */
  66.   unsigned long txtsize;    /* current text size */
  67. } NNTPLOCAL;
  68.  
  69.  
  70. /* Convenient access to local data */
  71.  
  72. #define LOCAL ((NNTPLOCAL *) stream->local)
  73.  
  74.  
  75. /* Convenient access to protocol-specific data */
  76.  
  77. #define NNTP stream->protocol.nntp
  78.  
  79. /* Compatibility support names */
  80.  
  81. #define nntp_open(hostlist,options) \
  82.   nntp_open_full (NIL,hostlist,"nntp",NNTPTCPPORT,options)
  83.  
  84.  
  85. /* Function prototypes */
  86.  
  87. DRIVER *nntp_valid (char *name);
  88. DRIVER *nntp_isvalid (char *name,char *mbx);
  89. void *nntp_parameters (long function,void *value);
  90. void nntp_scan (MAILSTREAM *stream,char *ref,char *pat,char *contents);
  91. void nntp_list (MAILSTREAM *stream,char *ref,char *pat);
  92. void nntp_lsub (MAILSTREAM *stream,char *ref,char *pat);
  93. long nntp_canonicalize (char *ref,char *pat,char *pattern);
  94. long nntp_subscribe (MAILSTREAM *stream,char *mailbox);
  95. long nntp_unsubscribe (MAILSTREAM *stream,char *mailbox);
  96. long nntp_create (MAILSTREAM *stream,char *mailbox);
  97. long nntp_delete (MAILSTREAM *stream,char *mailbox);
  98. long nntp_rename (MAILSTREAM *stream,char *old,char *newname);
  99. long nntp_status (MAILSTREAM *stream,char *mbx,long flags);
  100. MAILSTREAM *nntp_mopen (MAILSTREAM *stream);
  101. void nntp_mclose (MAILSTREAM *stream,long options);
  102. void nntp_fetchfast (MAILSTREAM *stream,char *sequence,long flags);
  103. void nntp_flags (MAILSTREAM *stream,char *sequence,long flags);
  104. long nntp_overview (MAILSTREAM *stream,char *sequence,overview_t ofn);
  105. char *nntp_header (MAILSTREAM *stream,unsigned long msgno,unsigned long *size,
  106.            long flags);
  107. long nntp_text (MAILSTREAM *stream,unsigned long msgno,STRING *bs,long flags);
  108. void nntp_flagmsg (MAILSTREAM *stream,MESSAGECACHE *elt);
  109. unsigned long *nntp_sort (MAILSTREAM *stream,char *charset,SEARCHPGM *spg,
  110.               SORTPGM *pgm,long flags);
  111. SORTCACHE **nntp_sort_loadcache (MAILSTREAM *stream,SORTPGM *pgm,long start,
  112.                  long last,long flags);
  113. THREADNODE *nntp_thread (MAILSTREAM *stream,char *type,char *charset,
  114.              SEARCHPGM *spg,long flags);
  115. long nntp_ping (MAILSTREAM *stream);
  116. void nntp_check (MAILSTREAM *stream);
  117. void nntp_expunge (MAILSTREAM *stream);
  118. long nntp_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long options);
  119. long nntp_append (MAILSTREAM *stream,char *mailbox,char *flags,char *date,
  120.           STRING *message);
  121.  
  122.  
  123. SENDSTREAM *nntp_open_full (NETDRIVER *dv,char **hostlist,char *service,
  124.                 unsigned long port,long options);
  125. SENDSTREAM *nntp_close (SENDSTREAM *stream);
  126. long nntp_mail (SENDSTREAM *stream,ENVELOPE *msg,BODY *body);
  127. long nntp_send (SENDSTREAM *stream,char *command,char *args);
  128. long nntp_send_work (SENDSTREAM *stream,char *command,char *args);
  129. long nntp_send_auth (SENDSTREAM *stream);
  130. long nntp_send_auth_work (SENDSTREAM *stream,NETMBX *mb,char *tmp);
  131. long nntp_reply (SENDSTREAM *stream);
  132. long nntp_fake (SENDSTREAM *stream,long code,char *text);
  133. long nntp_soutr (void *stream,char *s);
  134.