2011-11-13 00:38:59 +01:00
|
|
|
/* tools.h : 18-Apr-00 */
|
2011-11-13 00:38:55 +01:00
|
|
|
|
2011-11-13 00:38:59 +01:00
|
|
|
/* (C)opyright (C) 1993-2000 Martin Stover, Marburg, Germany
|
2011-11-13 00:38:55 +01:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
2011-11-13 00:38:56 +01:00
|
|
|
#ifndef _TOOLS_H_
|
|
|
|
#define _TOOLS_H_
|
2011-11-13 00:38:55 +01:00
|
|
|
|
2011-11-13 00:38:56 +01:00
|
|
|
/* processes which need tools */
|
2011-11-13 00:38:56 +01:00
|
|
|
#define NWSERV 1
|
|
|
|
#define NCPSERV 2
|
|
|
|
#define NWCONN 3
|
|
|
|
#define NWCLIENT 4
|
|
|
|
#define NWBIND 5
|
2011-11-13 00:38:56 +01:00
|
|
|
#define NWROUTED 6
|
2011-11-13 00:38:55 +01:00
|
|
|
|
2013-11-05 11:54:31 +01:00
|
|
|
/* extern FILE *logfile; */
|
2011-11-13 00:38:55 +01:00
|
|
|
extern void x_x_xfree(char **p);
|
|
|
|
extern int x_x_xnewstr(uint8 **p, uint8 *s);
|
|
|
|
|
|
|
|
#define xfree(p) x_x_xfree((char **)&(p))
|
|
|
|
#define new_str(p, s) x_x_xnewstr((uint8 **)&(p), s)
|
|
|
|
|
|
|
|
extern char *xmalloc(uint size);
|
2011-11-13 00:38:55 +01:00
|
|
|
extern char *xcmalloc(uint size);
|
2011-11-13 00:38:56 +01:00
|
|
|
extern int strmaxcpy(uint8 *dest, uint8 *source, int len);
|
2011-11-13 00:38:56 +01:00
|
|
|
#define xstrcpy(d, s) strmaxcpy((d), (s), sizeof(d)-1)
|
|
|
|
#define xstrmaxcpy(d, s, len) strmaxcpy((d), (s), min(sizeof(d)-1, (len)) )
|
|
|
|
|
2011-11-13 00:38:55 +01:00
|
|
|
extern void xdprintf(int dlevel, int mode, char *p, ...);
|
2011-11-13 00:38:55 +01:00
|
|
|
extern void errorp(int mode, char *what, char *p, ...);
|
2011-11-13 00:38:55 +01:00
|
|
|
extern FILE *open_nw_ini(void);
|
2011-11-13 00:38:56 +01:00
|
|
|
extern int get_ini_entry(FILE *f, int entry, uint8 *str, int strsize);
|
2011-11-13 00:38:56 +01:00
|
|
|
extern char *get_div_pathes(char *buff, char *name, int what, char *p, ... );
|
|
|
|
#define get_exec_path(bu, progn) get_div_pathes((bu), (progn), 0, NULL)
|
|
|
|
|
2011-11-13 00:38:55 +01:00
|
|
|
extern int get_ini_int(int what);
|
2011-11-13 00:38:55 +01:00
|
|
|
extern void get_ini_debug(int what);
|
2011-11-13 00:38:58 +01:00
|
|
|
extern void get_debug_level(uint8 *buf);
|
2011-11-13 00:38:56 +01:00
|
|
|
extern void init_tools(int module, int options);
|
|
|
|
extern void exit_tools(void);
|
2011-11-13 00:38:55 +01:00
|
|
|
|
|
|
|
extern uint8 down_char(uint8 ch);
|
|
|
|
extern uint8 up_char(uint8 ch);
|
2011-11-13 00:38:56 +01:00
|
|
|
extern uint8 *downstr(uint8 *ss);
|
|
|
|
extern uint8 *upstr(uint8 *ss);
|
2011-11-13 00:38:55 +01:00
|
|
|
|
2011-11-13 00:38:57 +01:00
|
|
|
extern int hextoi(char *buf);
|
2011-11-13 00:38:59 +01:00
|
|
|
extern int octtoi(char *buf);
|
|
|
|
|
2011-11-13 00:38:58 +01:00
|
|
|
extern unsigned int atou(char *buf);
|
2011-11-13 00:38:57 +01:00
|
|
|
extern char *hex_str(char *buf, uint8 *s, int len);
|
2011-11-13 00:38:55 +01:00
|
|
|
|
2011-11-13 00:38:57 +01:00
|
|
|
extern int name_match(uint8 *s, uint8 *p);
|
|
|
|
|
2011-11-13 00:38:58 +01:00
|
|
|
extern int nw_debug;
|
|
|
|
extern uint32 debug_mask;
|
2011-11-13 00:38:59 +01:00
|
|
|
|
|
|
|
extern int act_ncpsequence; /* for debugging */
|
|
|
|
extern int act_connection; /* which connection (nwconn, nwbind) */
|
|
|
|
extern time_t act_time; /* actual time */
|
|
|
|
|
2011-11-13 00:38:58 +01:00
|
|
|
#include "debmask.h"
|
2011-11-13 00:38:56 +01:00
|
|
|
#if DO_DEBUG
|
2011-11-13 00:38:55 +01:00
|
|
|
# define XDPRINTF(x) xdprintf x
|
2011-11-13 00:38:56 +01:00
|
|
|
# define D() XDPRINTF((3, 0, "Z: %d" , __LINE__));
|
2011-11-13 00:38:58 +01:00
|
|
|
# define MDEBUG(mask, x) if (mask & debug_mask) x
|
2011-11-13 00:38:55 +01:00
|
|
|
#else
|
|
|
|
# define XDPRINTF(x) /* */
|
2011-11-13 00:38:56 +01:00
|
|
|
# define D() /* */
|
2011-11-13 00:38:58 +01:00
|
|
|
# define MDEBUG(mask, x) /* */
|
2011-11-13 00:38:55 +01:00
|
|
|
#endif
|
|
|
|
|
2011-11-13 00:38:59 +01:00
|
|
|
|
|
|
|
#ifndef LINUX
|
|
|
|
extern int fixed_sprintf(char *buf, char *p, ...);
|
|
|
|
#define sprintf fixed_sprintf
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern int slprintf(char *buf, int bufsize, char *p, ...);
|
|
|
|
|
|
|
|
extern char *gettmpstr(char *qs, int len, int extralen);
|
|
|
|
extern int is_filelink(char *fn);
|
|
|
|
|
2011-11-13 00:38:56 +01:00
|
|
|
#endif /* _TOOLS_H_ */
|
|
|
|
|