1 /*****************************************************************************/
2 /*                                                                           */
3 /*                 (C) Copyright 1992-1997  Alberto Pasquale                 */
4 /*                                                                           */
5 /*                   A L L   R I G H T S   R E S E R V E D                   */
6 /*                                                                           */
7 /*****************************************************************************/
8 /*                                                                           */
9 /* How to contact the author:  Alberto Pasquale of 2:332/504@fidonet         */
10 /*                             Viale Verdi 106                               */
11 /*                             41100 Modena                                  */
12 /*                             Italy                                         */
13 /*                                                                           */
14 /*****************************************************************************/
15 
16 // Addrs.h
17 
18 
19 #ifndef ADDRS_H
20 #define ADDRS_H
21 
22 #include "defines.hpp"
23 
24 extern "C" {
25 #include <smapi/msgapi.h>
26 };
27 
28 typedef NETADDR ADR;
29 
30 
31 struct EXTADR : public ADR {
32     word region;
33     word hub;
34 };
35 
36 
37 struct ADRLST {
38    ADR adr;
39    ADRLST *next;
40 };
41 
42 
43 void get_addr_2d (const char *p, ADR *adr);
44 // leave zone as is, get net/node, set point=0
45 
46 
47 BOOL get_addr (const char **adrs, ADR *adr);
48 
49 // Skip blank, get 3D or 4D address, advance adrs to next token, return TRUE
50 // If no 3D/4D address, adr = 0:0/0.0, advance adrs to first token, return FALSE
51 
52 
53 BOOL get_next_addr (const char **adrs, ADR *adr, ADR *padr);
54 
55 // Skip blank, get 3D or 4D address assuming zone, net, node from padr if
56 // necessary, advance adrs to next token, return TRUE
57 // If no address, advance adrs to first token, return FALSE.
58 // padr can point to the same object as adr !
59 
60 ADRLST **get_addr_lst (const char **adrs, ADRLST **tail);
61 
62 // get_next_addr while address available and store in ADRLST
63 // chain appending to tail, advance adrs to first non-address token,
64 // return the pointer to the tail.
65 // If no address, advance adrs to first token and return tail.
66 
67 
68 BOOL get_part_addr (const char **adrs, ADR *adr);
69 
70 // Skip blank, get partial address (z, z:n, z:n/f, z:n/f.p, where n can be
71 // net or region), advance adrs to next token, return TRUE
72 // If no address, advance adrs to first token, return FALSE;
73 // All fields not stored are set to -1
74 
75 BOOL get_part_addr (const char *adrs, EXTADR *adr);
76 
77 // Skip blank, get partial address optionally followed by region and hub,
78 // return TRUE. If no address, return FALSE.
79 // zone/net/node/point not stored are set to -1.
80 // region/hub not stored are set to 0.
81 // e.g.: 2:332/505 33 500; 2:332/500 33; 2:332 33
82 
83 ADRLST **get_part_addr_lst (const char **adrs, ADRLST **tail);
84 
85 // get_part_addr while address available and append to ADRLST chain,
86 // advance adrs to next token, return pointer to the tail.
87 // If no address, advance adrs to first token, return tail.
88 
89 
90 BOOL InAdrLst (ADR *adr, ADRLST *al);
91 
92 // Look for an address in a list, return TRUE if found, FALSE if not.
93 
94 
95 BOOL InPartAdrLst (const EXTADR *adr, ADRLST *pal);
96 
97 // Look for an adress/region/hub in a partial-address list.
98 
99 
100 void SetAddr (ADR *adr, word zone, word net, word node, word point);
101 
102 // Set Addr to the specified fields
103 
104 #endif
105