Airframe Application Utilities
libairframe 0.7.2 API documentation

Main Page | Data Structures | File List | Data Fields | Globals

airutil.h

Go to the documentation of this file.
00001 /*
00002  ** airutil.c
00003  ** General utility functions
00004  **
00005  ** ------------------------------------------------------------------------
00006  ** Copyright (C) 2005-2008 Carnegie Mellon University. All Rights Reserved.
00007  ** ------------------------------------------------------------------------
00008  ** Authors: Brian Trammell <bht@cert.org>
00009  ** ------------------------------------------------------------------------
00010  ** GNU Lesser GPL Rights pursuant to Version 2.1, February 1999 
00011  ** Government Purpose License Rights (GPLR) pursuant to DFARS 252.225-7013
00012  ** ------------------------------------------------------------------------
00013  */
00014 
00015 /* Yeah, this is a dumb place for mainpage */
00016 
00087 /* idem hack */
00088 #ifndef _AIR_AIRUTIL_H_
00089 #define _AIR_AIRUTIL_H_
00090 
00091 #include <airframe/autoinc.h>
00092 
00094 #define AIR_TIME_BUF_MINSZ       20
00095 
00096 #define AIR_IPADDR_BUF_MINSZ     16
00097 
00098 #define AIR_IP6ADDR_BUF_MINSZ    40
00099 
00101 typedef enum air_timefmt_en {
00103     AIR_TIME_ISO8601,
00105     AIR_TIME_ISO8601_NS,
00107     AIR_TIME_SQUISHED,
00109     AIR_TIME_ISO8601_HMS
00110 } AirTimeFormat;
00111 
00120 void air_time_g_string_append(
00121     GString         *str,
00122     time_t          time,
00123     AirTimeFormat   fmtid);
00124 
00134 void air_mstime_g_string_append(
00135     GString         *str,
00136     uint64_t        mstime,
00137     AirTimeFormat   fmtid);
00138 
00147 void air_time_buf_print(
00148     char           *buf,
00149     time_t          time,
00150     AirTimeFormat   fmtid);
00151 
00167 time_t air_time_gm(
00168     uint32_t        year,
00169     uint32_t        mon,
00170     uint32_t        day,
00171     uint32_t        hour,
00172     uint32_t        min,
00173     uint32_t        sec);
00174 
00183 void air_ipaddr_buf_print(
00184     char            *buf,
00185     uint32_t         ipaddr);
00186 
00194 void air_ip6addr_buf_print(
00195     char            *buf,
00196     uint8_t         *ipaddr);
00197 
00206 uint32_t air_mask_from_prefix(
00207     uint32_t            pfx);
00208 
00220 void air_hexdump_g_string_append(
00221     GString             *str,
00222     char                *lpfx,
00223     uint8_t             *buf,
00224     uint32_t            len);
00225 
00235 gboolean air_sock_maxrcvbuf(
00236     int         sock,
00237     int         *size);
00238 
00248 gboolean air_sock_maxsndbuf(
00249     int         sock,
00250     int         *size);
00251 
00257 void air_ignore_sigpipe();
00258     
00259 /* end idem */
00260 #endif