AmendHub

Download

jcs

/

subtext

/

AddressXlation.h

 

(View History)

jcs   *: Lots of little cleanup Latest amendment: 101 on 2022-05-15

1 /*
2 AddressXlation.h
3 MacTCP name to address translation routines.
4
5 Copyright Apple Computer, Inc. 1988
6 All rights reserved
7
8 */
9
10 #ifndef __ADDRESSXLATION__
11 #define __ADDRESSXLATION__
12
13 #include "MacTCP.h"
14
15 #define NUM_ALT_ADDRS 4
16
17 struct hostInfo {
18 int _pad; /* XXX: i don't know why this is needed, but without it,
19 * StrToAddrProcPtr() returns everything shifted 2 bytes */
20 int rtnCode;
21 char cname[255];
22 unsigned long addr[NUM_ALT_ADDRS];
23 };
24
25 enum AddrClasses {
26 A = 1,
27 NS,
28 CNAME = 5,
29 lastClass = 65535
30 };
31
32 struct cacheEntryRecord {
33 char *cname;
34 unsigned short type;
35 enum AddrClasses class;
36 unsigned long ttl;
37 union {
38 char *name;
39 ip_addr addr;
40 } rdata;
41 };
42
43 typedef pascal void (*EnumResultProcPtr)(struct cacheEntryRecord *cacheEntryRecordPtr,
44 char *userDataPtr);
45 typedef pascal void (*ResultProcPtr)(struct hostInfo *hostInfoPtr,
46 char *userDataPtr);
47
48 extern OSErr OpenResolver(char *fileName);
49 extern OSErr StrToAddr(char *hostName, struct hostInfo *hostInfoPtr,
50 ResultProcPtr resultProc, char *userDataPtr);
51 extern OSErr AddrToStr(unsigned long addr, char *addrStr);
52 extern OSErr EnumCache(EnumResultProcPtr enumResultProc, char *userDataPtr);
53 extern OSErr AddrToName(ip_addr addr, struct hostInfo *hostInfoPtr,
54 ResultProcPtr resultProc, char *userDataPtr);
55 extern OSErr CloseResolver(void);
56
57 /*
58 * The above functions call into the dnr resource and pass the function id
59 * and function-specific arguments, so the compiler needs to know the types
60 */
61 typedef OSErr (*OpenResolverProcPtr)(UInt32, char *);
62 typedef OSErr (*CloseResolverProcPtr)(UInt32);
63 typedef OSErr (*StrToAddrProcPtr)(UInt32, char *hostName,
64 struct hostInfo *hostInfoPtr, ResultProcPtr resultProc,
65 char *userDataPtr);
66 typedef OSErr (*AddrToStrProcPtr)(UInt32, unsigned long addr,
67 char *addrStr);
68 typedef OSErr (*EnumCacheProcPtr)(UInt32, EnumResultProcPtr enumResultProc,
69 char *userDataPtr);
70 typedef OSErr (*AddrToNameProcPtr)(UInt32, ip_addr addr,
71 struct hostInfo *hostInfoPtr, ResultProcPtr resultProc,
72 char *userDataPtr);
73
74 #endif