464 lines
12 KiB
C
464 lines
12 KiB
C
/* ipmip_ntop.h - ipmip_ntop.h */
|
|
/*
|
|
******************************************************************************
|
|
* HEADER FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip_ntop.h,v $ $Revision: 1.8 $
|
|
* $Source: /home/interpeak/CVSRoot/ipmip/include/private/ipmip_ntop.h,v $
|
|
* $Author: jhorteli $ $Date: 2010-12-07 09:55:01 $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
#ifndef IPMIP_NTOP_H
|
|
#define IPMIP_NTOP_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
* Debug utility class providing functions to ease print's of various
|
|
* values such as hexarrays, lla's, addresses and non-zero-terminated
|
|
* strings.
|
|
*/
|
|
/*
|
|
DESCRIPTION
|
|
|
|
Debug utility class providing functions to ease print's of various
|
|
values such as hexarrays, lla's, addresses and non-zero-terminated
|
|
strings.
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#ifdef IPMIP_USE_INET6
|
|
#define IPMIP_ADDRESS_ADDRSIZE (IP_INET6_ADDRSTRLEN * 2)
|
|
#else
|
|
#define IPMIP_ADDRESS_ADDRSIZE (IP_INET_ADDRSTRLEN * 2)
|
|
#endif
|
|
#define IPMIP_ADDRESS_ADDRMASK 3
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
struct Ipmip_lladdr;
|
|
struct Ipmip_proc;
|
|
struct Ipmip_if;
|
|
struct Ip_timeval;
|
|
|
|
typedef struct Ipmip_ntop
|
|
{
|
|
Ip_u32 ntop_index;
|
|
char ntop_pbuf[256];
|
|
char ntop_lla[64];
|
|
char ntop_name[64];
|
|
char ntop_buffer[IPMIP_ADDRESS_ADDRMASK + 1][IPMIP_ADDRESS_ADDRSIZE];
|
|
} Ipmip_ntop_t;
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_ntop - ipmip_ntop
|
|
*
|
|
* Converts a ip address to a human readable text
|
|
* representation. The text representation resides
|
|
* in a static buffer capable of holding up to four
|
|
* different results.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i proc
|
|
* The process context associated with the currently executing thread. Each
|
|
* thread and/or process in MIP must have its own unique process context.
|
|
* If a process is started using ipmip_proc_start, the process context will
|
|
* be allocated automatically by the IPMIP framework. Otherwise it must
|
|
* be allocated using ipmip_proc_alloc().
|
|
* \i family
|
|
* The IP family
|
|
* \i un
|
|
* Address union
|
|
* \ie
|
|
*
|
|
* RETURNS: A pointer to the static buffer holding the result.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL const char * ipmip_ntop
|
|
(
|
|
struct Ipmip_proc *proc,
|
|
Ip_u8 family,
|
|
const void *un,
|
|
struct Ipmip_if *ifp
|
|
);
|
|
|
|
#ifdef IPMIP_USE_INET
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_ntop_inet - ipmip_ntop_inet
|
|
*
|
|
* Converts a ip address to a human readable text
|
|
* representation. The text representation resides
|
|
* in a static buffer capable of holding up to four
|
|
* different results.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i proc
|
|
* The process context associated with the currently executing thread. Each
|
|
* thread and/or process in MIP must have its own unique process context.
|
|
* If a process is started using ipmip_proc_start, the process context will
|
|
* be allocated automatically by the IPMIP framework. Otherwise it must
|
|
* be allocated using ipmip_proc_alloc().
|
|
* \i addr
|
|
* Address
|
|
* \ie
|
|
*
|
|
* RETURNS: A pointer to the static buffer holding the result.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL const char * ipmip_ntop_inet
|
|
(
|
|
struct Ipmip_proc *proc,
|
|
Ip_u32 addr
|
|
);
|
|
#endif
|
|
|
|
#ifdef IPMIP_USE_INET6
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_ntop_inet6 - ipmip_ntop_inet6
|
|
*
|
|
* Converts a ip address to a human readable text
|
|
* representation. The text representation resides
|
|
* in a static buffer capable of holding up to four
|
|
* different results.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i proc
|
|
* The process context associated with the currently executing thread. Each
|
|
* thread and/or process in MIP must have its own unique process context.
|
|
* If a process is started using ipmip_proc_start, the process context will
|
|
* be allocated automatically by the IPMIP framework. Otherwise it must
|
|
* be allocated using ipmip_proc_alloc().
|
|
* \i addr
|
|
* Address
|
|
* \i ifp
|
|
* scope
|
|
* \ie
|
|
*
|
|
* RETURNS: A pointer to the static buffer holding the result.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL const char * ipmip_ntop_inet6
|
|
(
|
|
struct Ipmip_proc *proc,
|
|
const struct Ip_in6_addr *addr,
|
|
struct Ipmip_if *ifp
|
|
);
|
|
#endif
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_ntop_sa - ipmip_ntop_sa
|
|
*
|
|
* Converts a ip address to a human readable text
|
|
* representation. The text representation resides
|
|
* in a static buffer capable of holding up to four
|
|
* different results.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i proc
|
|
* The process context associated with the currently executing thread. Each
|
|
* thread and/or process in MIP must have its own unique process context.
|
|
* If a process is started using ipmip_proc_start, the process context will
|
|
* be allocated automatically by the IPMIP framework. Otherwise it must
|
|
* be allocated using ipmip_proc_alloc().
|
|
* \i un
|
|
* The sockaddr struct
|
|
* \ie
|
|
*
|
|
* RETURNS: A pointer to the static buffer holding the result.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL const char * ipmip_ntop_sa
|
|
(
|
|
struct Ipmip_proc *proc,
|
|
union Ip_sockaddr_union *un
|
|
);
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip4_ntop_lla - ipmip4_ntop_lla
|
|
*
|
|
* Try to convert a LLA represented L2/SOL address to
|
|
* some form of human readable output
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i proc
|
|
* The process context associated with the currently executing thread. Each
|
|
* thread and/or process in MIP must have its own unique process context.
|
|
* If a process is started using ipmip_proc_start, the process context will
|
|
* be allocated automatically by the IPMIP framework. Otherwise it must
|
|
* be allocated using ipmip_proc_alloc().
|
|
* \i lla
|
|
* The LLA extension
|
|
* \ie
|
|
*
|
|
* RETURNS: A pointer to a static buffer containing the LLA output.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL const char * ipmip_ntop_lladdr
|
|
(
|
|
struct Ipmip_proc *proc,
|
|
struct Ipmip_lladdr *lla
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_ntop_lladdr_type - ipmip_ntop_lladdr_type
|
|
*
|
|
* Try to convert a LLA represented L2/SOL address to
|
|
* some form of human readable output
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i proc
|
|
* The process context associated with the currently executing thread. Each
|
|
* thread and/or process in MIP must have its own unique process context.
|
|
* If a process is started using ipmip_proc_start, the process context will
|
|
* be allocated automatically by the IPMIP framework. Otherwise it must
|
|
* be allocated using ipmip_proc_alloc().
|
|
* \i type
|
|
* The MAC type
|
|
* \i subtype
|
|
* The MAC subtype
|
|
* \i mac
|
|
* The MAC
|
|
* \ie
|
|
*
|
|
* RETURNS: A pointer to a static buffer containing the LLA output.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL const char * ipmip_ntop_lladdr_type
|
|
(
|
|
struct Ipmip_proc *proc,
|
|
Ip_u8 type,
|
|
Ip_u8 subtype,
|
|
void *mac,
|
|
Ip_size_t mac_len
|
|
);
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_ntop_hex - ipmip_ntop_hex
|
|
*
|
|
* Try to convert a binary value to readable hexadecimal output
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i proc
|
|
* The process context associated with the currently executing thread. Each
|
|
* thread and/or process in MIP must have its own unique process context.
|
|
* If a process is started using ipmip_proc_start, the process context will
|
|
* be allocated automatically by the IPMIP framework. Otherwise it must
|
|
* be allocated using ipmip_proc_alloc().
|
|
* \i hxarr
|
|
* The array
|
|
* \i sz
|
|
* Size of the array
|
|
* \ie
|
|
*
|
|
* RETURNS: A pointer to a static buffer containing the hex output.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL const char * ipmip_ntop_hex
|
|
(
|
|
struct Ipmip_proc *proc,
|
|
Ip_u8 *hxarr,
|
|
Ip_size_t sz
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_ntop_time - ipmip_ntop_time
|
|
*
|
|
* Try to convert a time value to human readable using ctime
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i proc
|
|
* The process context associated with the currently executing thread. Each
|
|
* thread and/or process in MIP must have its own unique process context.
|
|
* If a process is started using ipmip_proc_start, the process context will
|
|
* be allocated automatically by the IPMIP framework. Otherwise it must
|
|
* be allocated using ipmip_proc_alloc().
|
|
* \i tval
|
|
* The time
|
|
* \ie
|
|
*
|
|
* RETURNS: A pointer to a static buffer containing the time output
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL const char * ipmip_ntop_time
|
|
(
|
|
struct Ipmip_proc *proc,
|
|
Ip_time_t tval
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_ntop_tm - ipmip_ntop_tm
|
|
*
|
|
* Try to convert a time value to human readable using strftime
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i proc
|
|
* The process context associated with the currently executing thread. Each
|
|
* thread and/or process in MIP must have its own unique process context.
|
|
* If a process is started using ipmip_proc_start, the process context will
|
|
* be allocated automatically by the IPMIP framework. Otherwise it must
|
|
* be allocated using ipmip_proc_alloc().
|
|
* \i tval
|
|
* The time
|
|
* \ie
|
|
*
|
|
* RETURNS: A pointer to a static buffer containing the time output
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL const char *ipmip_ntop_tm
|
|
(
|
|
struct Ipmip_proc *proc,
|
|
Ip_time_t tval
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_ntop_tv - ipmip_ntop_tv
|
|
*
|
|
* Try to convert a time value to human readable using strftime
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i proc
|
|
* The process context associated with the currently executing thread. Each
|
|
* thread and/or process in MIP must have its own unique process context.
|
|
* If a process is started using ipmip_proc_start, the process context will
|
|
* be allocated automatically by the IPMIP framework. Otherwise it must
|
|
* be allocated using ipmip_proc_alloc().
|
|
* \i tv
|
|
* The time
|
|
* \ie
|
|
*
|
|
* RETURNS: A pointer to a static buffer containing the time output
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL const char *ipmip_ntop_tv
|
|
(
|
|
struct Ipmip_proc *proc,
|
|
struct Ip_timeval *tv
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_ntop_strn - ipmip_ntop_strn
|
|
*
|
|
* Create a zero terminated string representation.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i proc
|
|
* The process context associated with the currently executing thread. Each
|
|
* thread and/or process in MIP must have its own unique process context.
|
|
* If a process is started using ipmip_proc_start, the process context will
|
|
* be allocated automatically by the IPMIP framework. Otherwise it must
|
|
* be allocated using ipmip_proc_alloc().
|
|
* \i str
|
|
* The string
|
|
* \i str_len
|
|
* The length of the string
|
|
* \ie
|
|
*
|
|
* RETURNS: A pointer to a static buffer containing the time output
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL const char * ipmip_ntop_strn
|
|
(
|
|
struct Ipmip_proc *proc,
|
|
const char *str,
|
|
Ip_size_t str_len
|
|
);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|