home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C++ / Applications / Nuntius 1.2 / src / Nuntius / AddressXlation.h next >
Encoding:
C/C++ Source or Header  |  1994-02-20  |  2.5 KB  |  107 lines  |  [TEXT/MPS ]

  1. /* 
  2.     AddressXlation.h        
  3.     MacTCP name to address translation routines.
  4.  
  5.     Copyright Apple Computer, Inc. 1988-91
  6.     All rights reserved
  7.     Modifications by Steve Falkenburg, Apple MacDTS 8/91
  8. */    
  9.  
  10. /* conditional #include -->SJF<-- */
  11.  
  12. #ifndef __ADDRESSXLATION__
  13. #define __ADDRESSXLATION__
  14.  
  15. /* added for misc. definitions -->SJF<-- */
  16. #ifndef __MACTCPCOMMONTYPES__
  17. #include <MacTCPCommonTypes.h>
  18. #endif
  19.  
  20.  
  21. #define NUM_ALT_ADDRS   4
  22.  
  23. typedef struct hostInfo {
  24.     long rtnCode;                           /* changed from int -->SJF<-- */
  25.     char cname[255];
  26.     unsigned long addr[NUM_ALT_ADDRS];
  27. };
  28.  
  29. typedef enum AddrClasses {
  30.     A = 1,
  31.     NS,
  32.     CNAME = 5,
  33.     HINFO = 13,
  34.     MX = 15,
  35.     lastClass = 32767
  36. } AddrClasses; 
  37.  
  38. typedef struct HInfoRec {
  39.     char cpuType[30];
  40.     char osType[30];
  41.     };
  42.  
  43. typedef struct MXRec {
  44.     unsigned short preference;
  45.     char exchange[255];
  46.     };
  47.     
  48. typedef struct returnRec {
  49.     long    rtnCode;
  50.     char cname[255];
  51.     union {
  52.         unsigned long addr[NUM_ALT_ADDRS];
  53.         struct HInfoRec hinfo;
  54.         struct MXRec mx;
  55.     } rdata;
  56. };
  57.  
  58. typedef struct cacheEntryRecord {
  59.     char *cname;
  60.     unsigned short type;
  61.     unsigned short cacheClass;              /* changed from class -->SJF<-- */
  62.     unsigned long ttl;
  63.     union {
  64.         char *name;
  65.         ip_addr addr;
  66.     } rdata;
  67. };
  68.  
  69. /* added for C++ support -->SJF<-- */
  70. #ifdef __cplusplus
  71. extern "C" {
  72. #endif
  73.  
  74.  
  75. #ifdef THINK_C
  76. typedef ProcPtr EnumResultProcPtr;
  77. typedef ProcPtr ResultProcPtr;
  78. typedef ProcPtr ResultProc2Ptr;
  79. #else
  80. typedef pascal void (*EnumResultProcPtr)(struct cacheEntryRecord *cacheEntryRecordPtr, char *userDataPtr);
  81. typedef pascal void (*ResultProcPtr)(struct hostInfo *hostInfoPtr, char *userDataPtr);
  82. typedef pascal void (*ResultProc2Ptr)(struct returnRec *returnRecPtr, char *userDataPtr);
  83. #endif
  84.  
  85. extern OSErr OpenResolver(char *fileName);
  86.  
  87. extern OSErr StrToAddr(char *hostName, struct hostInfo *hostInfoPtr, ResultProcPtr ResultProc, char *userDataPtr);
  88.  
  89. extern OSErr AddrToStr(unsigned long addr, char *addrStr);
  90.  
  91. extern OSErr EnumCache(EnumResultProcPtr enumResultProc, char *userDataPtr);
  92.  
  93. extern OSErr AddrToName(ip_addr addr, struct hostInfo *hostInfoPtr, ResultProcPtr ResultProc, char *userDataPtr);
  94.  
  95. extern OSErr HInfo(char *hostName, struct returnRec *returnRecPtr, ResultProc2Ptr resultProc, char *userDataPtr);
  96.  
  97. extern OSErr MXInfo(char *hostName, struct returnRec *returnRecPtr, ResultProc2Ptr resultProc, char *userDataPtr);
  98.  
  99. extern OSErr CloseResolver(void);   /* Added (void) to make it a prototype (Think C) -->SJF<-- */
  100.  
  101. /* added for C++ support -->SJF<-- */
  102. #ifdef __cplusplus
  103. }
  104. #endif
  105.  
  106. #endif      /* conditional include -->SJF<-- */
  107.