home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / metamail / contrib / ezview / mail.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-29  |  12.9 KB  |  271 lines

  1. /*
  2. Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
  3.  
  4. Permission to use, copy, modify, and distribute this material 
  5. for any purpose and without fee is hereby granted, provided 
  6. that the above copyright notice and this permission notice 
  7. appear in all copies, and that the name of Bellcore not be 
  8. used in advertising or publicity pertaining to this 
  9. material without the specific, prior written permission 
  10. of an authorized representative of Bellcore.  BELLCORE 
  11. MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
  12. OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
  13. WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
  14. */
  15. /* ********************************************************************** *\
  16.  *         Copyright IBM Corporation 1988,1989 - All Rights Reserved      *
  17.  *        For full copyright information see:'andrew/config/COPYRITE'     *
  18. \* ********************************************************************** */
  19. /*
  20.     Include file for /usr/andrew/lib/libmail.a.
  21. */
  22.  
  23. extern char *ams_genid();    /* Generates a world-unique identifier; Boolean parameter specifies whether or not to generate a long name */
  24. extern char *convlongto64();    /* converts a long and padding to 6 bytes base 64 */
  25. extern unsigned long conv64tolong(); /* reverses the above conversion, basically */
  26. extern char *arpadate();    /* Returns pointer to current ASCII date string in RFC821 format */
  27. extern char *EX_Messages[];    /* Text messages for sysexits.h */
  28. extern int EX_Nerr;    /* Number of error messages in above table */
  29. extern char *UnixSysExits();    /* Pass it a sysexits value and it returns a static description */
  30.  
  31. /* From vmail.c: */
  32. extern char VM_text[];    /* loaded with readable message for all vmail ops */
  33. extern int VM_errordetail;    /* loaded with a more specific error code from vmail ops */
  34. extern int VM_open();    /* pass User, Mailbox, ReturnPath, For, and Auth (all char*) */
  35. extern int VM_write();    /* pass addr of characters and number of chars */
  36. extern int VM_printf();    /* pass format string and parameters */
  37. extern int VM_close();    /* no parameters necessary */
  38. extern int VM_SetTiming();    /* pass Boolean for whether to do timing--flag cleared after VM_close */
  39. /* Values for VM_errordetail */
  40. #define vm_ViceDown 1
  41. #define vm_NotADir 2
  42. #define vm_NotOnVice 3
  43. #define vm_InternalError 4
  44. #define vm_NoSuchUser 5
  45. #define vm_AlreadyOpen 6
  46. #define vm_NotOpen 7
  47. #define vm_BadParameters 8
  48. #define vm_OverQuota 9
  49. #define vm_OutOfRetries 10
  50. #define vm_OutOfMemory 11
  51. #define vm_DirMayHaveMoved 12
  52. #define vm_SystemErrorOffset 100    /* added to errno values */
  53.  
  54.  
  55. /* extern char *LocalMailHostname;    Name of this host for mail purposes */
  56. extern int IsLocalAlias();    /* Says whether a name is a nickname for the local mail hostname */
  57.  
  58. extern void CanonicalizePersonName();    /* Interprets its char* argument as a person's
  59.                name and canonicalizes it, handling embedded spaces and dots.
  60.                Overwrites its argument.
  61.                The process turns ``a.b'' into ``a b'' and ``a..b'' into ``a. b''. */
  62.  
  63. struct ScribeState {
  64.     int    statecode;    /* current state */
  65.     int    previous_state;    /* last state, before \ processing */
  66.     int    writecount;
  67.  
  68.     /* The following are only used by Version 10 and higher */
  69.     int    begindatacount;    /* depth in dataobject tree. */
  70.     int    keywordpos;    /* position in keyword buffer. */
  71.     char *linefrag;    /* Line buffer. */
  72.     char *keyword;    /* Keyword buffer. */
  73.     char *stylebuf;    /* Buffer for {} contents. Used to name views */
  74.     short lmargin;    /* left margin of current line */
  75.     short rmargin;    /* right margin of current line */
  76.     short justify;    /* justification for this line */
  77.     short indent;    /* indentation for this line */
  78.     short specials;    /* count of extra characters needed at end of line */
  79.     short face;        /* face state from previous line */
  80.     short newpara;    /* flag: indicates that the first line of the paragraph is yet to be printed */
  81.     struct StateVector *vector;    /* Stack of style states kept as a linked list */
  82. };
  83.  
  84. extern int UnScribeInit();
  85.         /* int UnScribeInit(fieldvalue, refstate)
  86.             char *fieldvalue;
  87.             struct ScribeState **refstate;
  88.         Pass it the value of the X-Andrew-ScribeFormat: header
  89.         to see if the package can handle this format.
  90.         Returns a code value >= 0 for OK, < 0 for error.
  91.         Remember this code value to pass to UnScribe.
  92.         In addition, pass the address of a variable to hold the
  93.         UnScribe state between calls.  This variable will be
  94.         initialized (space malloced, too) with the UnScribeInit call.
  95.         Error value of -1 means that the field value wasn't recognized;
  96.         error value of -2 means that a malloc failed.
  97.         */
  98.  
  99. extern int UnScribe();
  100.         /* int UnScribe(code, refstate, text, textlen, fileptr)
  101.             int code, textlen;
  102.             struct ScribeState **refstate;
  103.             char *text;
  104.             FILE *fileptr;
  105.         Pass it the initial UnScribeInit return value and the address
  106.         of the integer state variable.  Also pass the address of the
  107.         text to be unscribed, and the number of bytes at that address.
  108.         The unscribed text will be written onto stdio file *fileptr.
  109.         Return values are >= 0 for OK (the number of characters
  110.         written), < 0 for errors.  Error value -1 means
  111.         that errno holds a useful code.    */
  112. extern int UnScribeFlush();
  113.         /* int UnScribeFlush(code, refstate, fileptr)
  114.             int code;
  115.             struct ScribeState **refstate;
  116.             FILE *fileptr;
  117.         Call this to unbuffer an UnScribe sequence.  If the UnScribe
  118.         routine has buffered any data, this call cues it to un-buffer it.
  119.         Returns zero for OK, non-zero for failures.
  120.         This routine also frees up the refstate.
  121.         */
  122. extern int UnScribeAbort();
  123.         /* int UnScribeAbort(code, refstate)
  124.             int code;
  125.             struct ScribeState **refstate;
  126.         Call this to undo (abortively) an UnScribeInit without needing
  127.         an active stdio file to which to write buffered data.
  128.         Returns 0 for all OK, non-zero for (presumably ignorable) errors.
  129.         */
  130. extern int PrintQuotingFormatting();
  131.         /* extern int PrintQuotingFormatting(fp, text, format, len)
  132.             FILE *fp;
  133.             char *text, *format;
  134.             int len;
  135.         Call this to write LEN chars from TEXT to file FP, assuming that
  136.         you want it encoded in format FORMAT (e.g., ``yes'', ``2'', or ``10'').
  137.         Returns the number of characters written, or 0 or -1 for errors (like fwrite).
  138.         */
  139. extern int PrintMaybeFoldQuotingFormatting();
  140.         /* extern int PrintMaybeFoldQuotingFormatting(fp, text, format, len, DoFold)
  141.             FILE *fp;
  142.             char *text, *format;
  143.             int len, DoFold;
  144.         Call this to write LEN chars from TEXT to file FP, assuming that
  145.         you want it encoded in format FORMAT (e.g., ``yes'', ``2'', or ``10'').
  146.         Returns the number of characters written, or 0 or -1 for errors (like fwrite).
  147.         Make DoFold non-zero to allow line folding.
  148.         */
  149.  
  150. enum MailHostQuality {mailhost_good, mailhost_bad, mailhost_indeterminate};
  151.  
  152. extern enum MailHostQuality ValidateMailHostName();
  153. extern enum MailHostQuality ValidateDomainMail();
  154.  
  155. /* Stuff for interpretation of local addresses (spec in la.spec) */
  156. struct MailDom {    /* pointed to by parsed addresses; result of valhost; managed in locaddr */
  157.     struct MailDom    *Next, *Prev;
  158.     int        Refs;        /* Reference count */
  159.     char        *Orig, *Final;
  160.     enum MailHostQuality    Qual;
  161.     unsigned long int    DomainAddress;
  162.     unsigned int    NumFwds;
  163.     unsigned short int    *FwdPrefs;
  164.     char        **Fwds;
  165. };
  166.  
  167. #define latype_Remote    0    /* addr->MD->Qual might say if good or bad host name */
  168. #define latype_LocalID    1
  169. #define latype_LocalName    2
  170. #define latype_DistList    3
  171. #define latype_DirInsert    4
  172. #define latype_FSMembers    5
  173. /* and more to follow.. */
  174.  
  175. #define laerr_NoError    0    /* no problem */
  176. #define laerr_OutOfMemory    1    /* a malloc() failed */
  177. #define laerr_SyntaxError    2    /* the local part had bad quoting syntax */
  178. #define laerr_UnrecSpecial    3    /* local part ``+foo+bar'' for unrecognized ``foo'' */
  179. #define laerr_WPerror    4    /* la_Resolve returns this sometimes */
  180. #define laerr_BadSecond    5    /* local address is foo+bar, where bar has white space. */
  181.  
  182. extern int la_Kind();    /* la_Kind(Addr, outType, outPrime, outSecond)
  183.             PARSED_ADDRESS *Addr;
  184.             int *outType; -- returns one of the latype_XXX codes
  185.             char **outPrime, **outSecond;    */
  186. extern int la_KindDomain();    /* la_KindDomain(Addr, outType, outPrime, outSecond, Domain)
  187.             PARSED_ADDRESS *Addr;
  188.             int *outType; -- returns one of the latype_XXX codes
  189.             char **outPrime, **outSecond; char *Domain    */
  190. extern char *la_ErrorString();    /* given a laerr_XXX code, tell you what the code means */
  191.  
  192. extern int la_Resolve();    /* la_Resolve(Addr, PrimePart, outSearchToken, outMinFound,
  193.                 MaxQuality, outMatchQuality, outPrimeKey)
  194.             PARSED_ADDRESS *Addr; char *PrimePart;
  195.             wp_SearchToken *outSearchToken;
  196.             int *outMinFound, MaxQuality, *outMatchQuality;
  197.             wp_PrimeKey *outPrimeKey;    */
  198.  
  199. extern int BracketField();    /* Searches for the contents of the named field. */
  200.  
  201. extern int IsOK822Atom();    /* TRUE iff the char argument could be part of an RFC822 Atom */
  202. #define is822Atom 1    /* Return codes from NextWord */
  203. #define is822QuotedString 2
  204. #define is822Special 3
  205. #define is822End 4
  206. extern int Next822Word();    /* next word */
  207. extern char *Next822LPart();    /* next local-part */
  208. extern char *Next822Phrase();    /* next phrase */
  209. extern char *Quote822LPart();    /* quote a local-part */
  210. extern char *Quote822Phrase();    /* quote a phrase */
  211.  
  212. extern int CheckAMSDelivery();    /* Hand it a cell name.  Returns >0 if that cell is running AMS delivery, <0 if they're not, 0 if it can't tell. */
  213. extern int CheckAMSNameSep();    /* Hand it a cell name; it determines what that cell uses as its space-substitution in validated mail names.  Returns -1 if no, 0 if you can't tell, and >0 if it does.  If the value is >0, it's the separator character itself. */
  214. extern char *CheckAMSMBName();    /* Hand it a cell name.  Returns what that cell uses as the name of its mail in-box directory, that accounts use to receive mail.  Returns NULL if it can't tell. */
  215. extern char *CheckAMSPMName();    /* Hand it a cell name.  Returns what that cell uses as the username of its distinguished delivery agent.  Returns NULL if it can't tell. */
  216. extern char *CheckAMSWPIAddr();    /* Hand it a cell name.  Returns what that cell uses as the address for WPI update requests.  Returns NULL if it can't tell. */
  217. extern int CheckAMSFmtOK(); /* Hand it a domain name.  Returns >0 if the domain accepts ATK-formatted mail, <0 if it doesn't, and 0 if we can't tell. */
  218. extern int CheckAMSUUCPSupp(); /* Hand it a domain name.  Returns >0 if the domain thinks a!b is a remote address, <0 if it doesn't, and 0 if we can't tell. */
  219. #define    vld_WPValid    0x1    /* AMS_WPValidation: 1 */
  220. #define    vld_PasswdValid    0x2    /* AMS_PasswdValidation: 1 */
  221. #define    vld_LocalDBValid    0x4    /* AMS_LocalDatabaseValidation: 1 */
  222. #define    vld_AliasesValid    0x8    /* AMS_AliasesValidation: 1 */
  223. extern int CheckAMSValidationMask(); /* Hand it a cell name.  Returns a mask for how that cell does its name validation.  Returns an int <0 if it can't find out. */
  224. /* Structure to describe a site's default MSPATH. */
  225. struct cell_msPath {
  226.     char    *Abbrev;    /* e.g. "local" or "external" */
  227.     char    *RootDir;    /* the root directory of that mspath element. */
  228.     char    *Decorate;    /* any square-bracketed decoration on the mspath element */
  229.     char    *RootCell;    /* the AFS cell in which this root sits */
  230.     int    Validated:1;    /* whether this one has been checked */
  231.     int    CkMailbox:1;    /* whether we check this one's mailbox */
  232. };
  233. extern int CheckAMSDfMSPath();    /* Given a cell name as its first parameter, it returns a count of cell_msPaths returned as an array via its second parameter.  Returns 0 if there are none.  Returns <0 if the domain name isn't running AMS delivery or there's some problem in finding the list. */
  234.  
  235. /* Functions to describe a user's authentication in multiple cells */
  236. extern char AMSHome_errmsg[];    /* Text describing the result of the FindAMSHomeCell call. */
  237. extern void ForgetAMSHome();    /* Forget the AMS home cell and everything else. */
  238. extern int FindAMSHomeCell();    /* int FindAMSHomeCell(ppCellAuth)
  239.                 struct CellAuth **ppCellAuth;
  240.         Returns a pointer to what the AMS thinks its home cell should be, if there is one.
  241.         Return 1 if there's no such cell, or 2 if there's no authentication at all. */
  242.  
  243. extern int SetAMSHomeCell();    /* int SetAMSHomeCell(cellAuth)
  244.                 struct CellAuth *cellAuth;
  245.         Declare that the given cellAuth should be marked as being the AMS home cell.
  246.         Can fail if the cell isn't the workstation's cell and the given cell isn't running AMS delivery. */
  247.  
  248.  
  249. /**** from fwdvalid.c ****/
  250. /*  fwdvalid_msgbuf:
  251.     ----------------
  252.     The char array where ValidateFwdAddr will put diagnostics.
  253.     */
  254. extern char fwdvalid_msgbuf[];
  255.  
  256.  
  257. /* fwdvalid_SetTildeUser:
  258.    ----------------------
  259.    Takes a string, and uses that to resolve addresses of the form
  260.    "+dir-insert+~/..." in later calls to ValidateFwdAddr. */
  261. extern void fwdvalid_SetTildeUser(/* [IN] char *s */);
  262.  
  263. /* ValidateFwdAddr:
  264.    ----------------
  265.    Takes a string (NewAddr), and checks it for validity as a (forwarding)
  266.    mail address.  Returns 0 if successful.  The "canonicalized"
  267.    form of NewAddr will be returned in FixedAddr (malloc'd).  Diagnostics
  268.    can be found in fwdvalid_msgbuf.  */
  269. extern int ValidateFwdAddr(/* [IN]  char *NewAddr, 
  270.                   [OUT] char **FixedAddr */);
  271.