1998-09-16 02:39:15 +00:00
|
|
|
/* util.h
|
|
|
|
* Utility definitions
|
|
|
|
*
|
2000-07-31 04:53:40 +00:00
|
|
|
* $Id: util.h,v 1.20 2000/07/31 04:53:32 guy Exp $
|
1998-09-16 03:22:19 +00:00
|
|
|
*
|
1998-09-16 02:39:15 +00:00
|
|
|
* Ethereal - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@zing.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __UTIL_H__
|
|
|
|
#define __UTIL_H__
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2000-07-31 04:53:40 +00:00
|
|
|
/*
|
|
|
|
* Given a pathname, return:
|
|
|
|
*
|
|
|
|
* the errno, if an attempt to "stat()" the file fails;
|
|
|
|
*
|
|
|
|
* EISDIR, if the attempt succeeded and the file turned out
|
|
|
|
* to be a directory;
|
|
|
|
*
|
|
|
|
* 0, if the attempt succeeded and the file turned out not
|
|
|
|
* to be a directory.
|
|
|
|
*/
|
|
|
|
int test_for_directory(const char *);
|
|
|
|
|
2000-01-25 05:48:47 +00:00
|
|
|
/*
|
|
|
|
* Given a pathname, return the last component.
|
|
|
|
*/
|
2000-01-25 04:31:17 +00:00
|
|
|
char *get_basename(char *);
|
|
|
|
|
2000-01-25 05:48:47 +00:00
|
|
|
/*
|
|
|
|
* Given a pathname, return a string containing everything but the
|
|
|
|
* last component. NOTE: this overwrites the pathname handed into
|
|
|
|
* it....
|
|
|
|
*/
|
|
|
|
char *get_dirname(char *);
|
|
|
|
|
1999-08-18 02:59:05 +00:00
|
|
|
int create_tempfile(char *, int, const char *);
|
|
|
|
|
2000-01-29 16:41:28 +00:00
|
|
|
/* Returns the user's home directory, via the HOME environment
|
|
|
|
* variable, or a default directory if HOME is not set */
|
|
|
|
const char* get_home_dir(void);
|
|
|
|
|
2000-02-22 07:07:55 +00:00
|
|
|
/*
|
|
|
|
* Collect command-line arguments as a string consisting of the arguments,
|
|
|
|
* separated by spaces.
|
|
|
|
*/
|
|
|
|
char *get_args_as_string(int argc, char **argv, int optind);
|
|
|
|
|
1999-10-19 04:11:23 +00:00
|
|
|
void ASCII_to_EBCDIC(guint8 *buf, guint bytes);
|
1999-11-22 06:24:56 +00:00
|
|
|
guint8 ASCII_to_EBCDIC1(guint8 c);
|
1999-10-19 04:11:23 +00:00
|
|
|
void EBCDIC_to_ASCII(guint8 *buf, guint bytes);
|
1999-11-22 06:24:56 +00:00
|
|
|
guint8 EBCDIC_to_ASCII1(guint8 c);
|
1999-10-19 04:11:23 +00:00
|
|
|
|
2000-01-16 02:48:12 +00:00
|
|
|
#ifdef HAVE_LIBPCAP
|
|
|
|
|
|
|
|
GList *get_interface_list(int *err, char *err_str);
|
|
|
|
|
|
|
|
/* Error values from "get_interface_list()". */
|
|
|
|
#define CANT_GET_INTERFACE_LIST 0 /* error getting list */
|
|
|
|
#define NO_INTERFACES_FOUND 1 /* list is empty */
|
|
|
|
|
|
|
|
void free_interface_list(GList *if_list);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
1998-09-16 02:39:15 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
#endif /* __UTIL_H__ */
|