added QSE_GLOB_TOLERANT

enhanced check for __int128_t
added qse_getnwifcfg()
added qse_skad_t, qse_skadtonwad(), qse_nwadtoskad()
added more checks to configure.ac
This commit is contained in:
2012-11-16 16:46:49 +00:00
parent b94dd042c5
commit 034d3e9c04
26 changed files with 1541 additions and 275 deletions

View File

@ -45,7 +45,10 @@ enum qse_glob_flags_t
/** Perform case-insensitive matching.
* This option is always on in Win32/OS2/DOS. */
QSE_GLOB_IGNORECASE = (1 << 2)
QSE_GLOB_IGNORECASE = (1 << 2),
/** Make the function to be more fault-resistent */
QSE_GLOB_TOLERANT = (1 << 3)
};
#ifdef __cplusplus

View File

@ -37,7 +37,6 @@ typedef struct qse_nwad_t qse_nwad_t;
struct qse_nwad_t
{
qse_nwad_type_t type;
union
{
struct
@ -70,6 +69,21 @@ enum qse_nwadtostr_flag_t
#define QSE_NWADTOWCS_ALL QSE_NWADTOSTR_ALL
};
typedef struct qse_skad_t qse_skad_t;
struct qse_skad_t
{
#if (QSE_SIZEOF_STRUCT_SOCKADDR_IN > 0) && \
(QSE_SIZEOF_STRUCT_SOCKADDR_IN >= QSE_SIZEOF_STRUCT_SOCKADDR_IN6)
qse_uint8_t data[QSE_SIZEOF_STRUCT_SOCKADDR_IN];
#elif (QSE_SIZEOF_STRUCT_SOCKADDR_IN6 > 0) && \
(QSE_SIZEOF_STRUCT_SOCKADDR_IN6 >= QSE_SIZEOF_STRUCT_SOCKADDR_IN)
qse_uint8_t data[QSE_SIZEOF_STRUCT_SOCKADDR_IN6];
#else
/* no sockaddr_xxx is available */
qse_uint8_t data[QSE_SIZEOF(qse_nwad_t)];
#endif
};
#ifdef __cplusplus
extern "C" {
@ -126,6 +140,20 @@ qse_size_t qse_nwadtowcs (
# define qse_nwadtostr(nwad,ptr,len,flags) qse_nwadtowcs(nwad,ptr,len,flags)
#endif
int qse_skadtonwad (
const qse_skad_t* skad,
qse_nwad_t* nwad
);
int qse_nwadtoskad (
const qse_nwad_t* nwad,
qse_skad_t* skad
);
int qse_skadfamily (
const qse_skad_t* skad
);
#ifdef __cplusplus
}
#endif

View File

@ -23,6 +23,40 @@
#include <qse/types.h>
#include <qse/macros.h>
#include <qse/cmn/nwad.h>
typedef struct qse_nwifcfg_t qse_nwifcfg_t;
enum qse_nwifcfg_flag_t
{
QSE_NWIFCFG_UP = (1 << 0),
QSE_NWIFCFG_RUNNING = (1 << 1),
QSE_NWIFCFG_BCAST = (1 << 2),
QSE_NWIFCFG_PTOP = (1 << 3)
};
enum qse_nwifcfg_type_t
{
QSE_NWIFCFG_IN4,
QSE_NWIFCFG_IN6
};
typedef enum qse_nwifcfg_type_t qse_nwifcfg_type_t;
struct qse_nwifcfg_t
{
qse_nwifcfg_type_t type;
qse_char_t name[64];
/* TODO: add hwaddr?? */
int flags;
unsigned int index;
qse_nwad_t addr;
qse_nwad_t mask;
qse_nwad_t ptop;
qse_nwad_t bcast;
int mtu;
};
#ifdef __cplusplus
extern "C" {
@ -46,13 +80,13 @@ unsigned int qse_nwifwcsntoindex (
qse_size_t len
);
qse_size_t qse_nwifindextombs (
int qse_nwifindextombs (
unsigned int index,
qse_mchar_t* buf,
qse_size_t len
);
qse_size_t qse_nwifindextowcs (
int qse_nwifindextowcs (
unsigned int index,
qse_wchar_t* buf,
qse_size_t len

View File

@ -82,6 +82,10 @@
# define QSE_MBLEN_MAX 8
#
# define QSE_CHAR_IS_WCHAR
#
# /* these two have only to be large enough */
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN 32
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN6 64
#else
# error Define the size of various data types.
#endif

View File

@ -138,6 +138,10 @@ _M_X64 x64 platform
# define QSE_MBLEN_MAX 8
#
# define QSE_CHAR_IS_WCHAR
#
# /* these two have only to be large enough */
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN 32
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN6 64
#else
# error Define the size of various data types.
#endif

View File

@ -59,6 +59,10 @@
# define QSE_MBLEN_MAX 8
#
# define QSE_CHAR_IS_WCHAR
#
# /* these two have only to be large enough */
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN 32
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN6 64
#else
# error Define the size of various data types.
#endif

View File

@ -167,9 +167,15 @@
/* Define to 1 if you have the `gethostbyname' function. */
#undef HAVE_GETHOSTBYNAME
/* Define to 1 if you have the `getifaddrs' function. */
#undef HAVE_GETIFADDRS
/* Define to 1 if you have the `gettid' function. */
#undef HAVE_GETTID
/* Define to 1 if you have the <ifaddrs.h> header file. */
#undef HAVE_IFADDRS_H
/* Define to 1 if you have the `if_indextoname' function. */
#undef HAVE_IF_INDEXTONAME
@ -254,6 +260,9 @@
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
/* Define to 1 if you have the <net/if_dl.h> header file. */
#undef HAVE_NET_IF_DL_H
/* Define to 1 if you have the <net/if.h> header file. */
#undef HAVE_NET_IF_H
@ -377,6 +386,12 @@
/* Define to 1 if `d_type' is a member of `struct dirent'. */
#undef HAVE_STRUCT_DIRENT_D_TYPE
/* Define to 1 if `ifr_ifindex' is a member of `struct ifreq'. */
#undef HAVE_STRUCT_IFREQ_IFR_IFINDEX
/* Define to 1 if `ifr_mtu' is a member of `struct ifreq'. */
#undef HAVE_STRUCT_IFREQ_IFR_MTU
/* Define to 1 if `st_birthtime' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BIRTHTIME
@ -421,6 +436,12 @@
/* Define to 1 if you have the <sys/sendfile.h> header file. */
#undef HAVE_SYS_SENDFILE_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/sockio.h> header file. */
#undef HAVE_SYS_SOCKIO_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
@ -643,6 +664,12 @@
/* sizeof(short) */
#undef QSE_SIZEOF_SHORT
/* sizeof(struct sockaddr_in) */
#undef QSE_SIZEOF_STRUCT_SOCKADDR_IN
/* sizeof(struct sockaddr_in6) */
#undef QSE_SIZEOF_STRUCT_SOCKADDR_IN6
/* sizeof(void*) */
#undef QSE_SIZEOF_VOID_P
@ -706,6 +733,12 @@
/* The size of `short', as computed by sizeof. */
#undef SIZEOF_SHORT
/* The size of `struct sockaddr_in', as computed by sizeof. */
#undef SIZEOF_STRUCT_SOCKADDR_IN
/* The size of `struct sockaddr_in6', as computed by sizeof. */
#undef SIZEOF_STRUCT_SOCKADDR_IN6
/* The size of `void *', as computed by sizeof. */
#undef SIZEOF_VOID_P

View File

@ -346,7 +346,7 @@ typedef enum qse_tri_t qse_tri_t;
# define QSE_HAVE_UINT128_T
typedef __int128 qse_int128_t;
typedef unsigned __int128 qse_uint128_t;
#elif QSE_SIZEOF___INT128_T == 16
#elif (QSE_SIZEOF___INT128_T == 16)
# define QSE_HAVE_INT128_T
# define QSE_HAVE_UINT128_T
typedef __int128_t qse_int128_t;