1 /* $Id$ 2 * 3 * HUSKYLIB: common defines, types and functions for HUSKY 4 * 5 * This is part of The HUSKY Fidonet Software project: 6 * see http://husky.sourceforge.net for details 7 * 8 * 9 * HUSKYLIB is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU Lesser General Public 11 * License as published by the Free Software Foundation; either 12 * version 2 of the License, or (at your option) any later version. 13 * 14 * HUSKYLIB is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * General Public License for more details. 18 * 19 * You should have received a copy of the GNU Lesser General Public 20 * License along with this library; see file COPYING. If not, write to the 21 * Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * 23 * See also http://www.gnu.org, license may be found here. 24 */ 25 26 #ifndef HUSKY_PARSEFTN_H__ 27 #define HUSKY_PARSEFTN_H__ 28 29 /* huskylib: compiler.h */ 30 #include "compiler.h" 31 32 /* huskylib headers */ 33 #include "huskyext.h" 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 typedef struct _netaddr 40 { 41 sword zone; 42 sword net; 43 sword node; 44 sword point; 45 char domain[9]; 46 } hs_addr, *ps_addr; 47 48 #define FTNADDR_ZONE 0x01 49 #define FTNADDR_NET 0x02 50 #define FTNADDR_NODE 0x04 51 #define FTNADDR_POINT 0x08 52 #define FTNADDR_DOMAIN 0x10 53 #define FTNADDR_ERROR 0x80 54 55 #define FTNADDR_GOOD (FTNADDR_NODE | FTNADDR_NET | FTNADDR_ZONE) 56 #define FTNADDR_2D (FTNADDR_NODE | FTNADDR_NET) 57 #define FTNADDR_4D (FTNADDR_NODE | FTNADDR_NET | FTNADDR_ZONE) 58 #define FTNADDR_5D (FTNADDR_DOMAIN | FTNADDR_NODE | FTNADDR_NET | FTNADDR_ZONE) 59 60 /** function converts fidonet address from part of string to HS_NETADDR */ 61 HUSKYEXT int parseFtnAddr(const char *str, hs_addr *netAddr, int len, int mask, const char **end); 62 63 #define parseFtnAddrS(str, netAddr, len) parseFtnAddr((str), (netAddr), (len), FTNADDR_GOOD, NULL) 64 65 /** function converts fidonet address from zero-terminated string to HS_NETADDR */ 66 HUSKYEXT int parseFtnAddrZ(const char *str, hs_addr *netAddr, int mask, const char **end); 67 68 #define parseFtnAddrZS(str, netAddr) parseFtnAddrZ((str), (netAddr), FTNADDR_GOOD, NULL) 69 70 #ifdef __cplusplus 71 } 72 #endif 73 74 #endif 75