/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ File: oct_ws_macro.c Copyright (c) 2015 Octasic Inc. All rights reserved. Description: Wireshark macro 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Release: Octasic Application Development Framework OCTADF-03.03.00-B1571 (2015/03/24) $Octasic_Revision: 4 $ \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ #ifndef __OCT_WS_MACRO_H__ #define __OCT_WS_MACRO_H__ /***************************** INCLUDE FILES *******************************/ #include #include /***************************** DEFINES **************************************/ #ifndef UNUSED #ifdef __GNUC__ # define UNUSED(x) UNUSED_ ## x __attribute__((__unused__)) #else # define UNUSED(x) UNUSED_ ## x #endif #endif #ifndef UNUSED_FUNCTION #ifdef __GNUC__ # define UNUSED_FUNCTION(x) __attribute__((__unused__)) UNUSED_ ## x #else # define UNUSED_FUNCTION(x) UNUSED_ ## x #endif #endif #define mWS_RED_COMPONENT(x) (guint16) (((((x) >> 16) & 0xff) * 65535 / 255)) #define mWS_GREEN_COMPONENT(x) (guint16) (((((x) >> 8) & 0xff) * 65535 / 255)) #define mWS_BLUE_COMPONENT(x) (guint16) ( (((x) & 0xff) * 65535 / 255)) #define mWS_FIELDSIZE( type, field) (sizeof(((type *)0)->field)) #define mWS_FIELDOFFSET(type, field) ((guint32)&(((type *)0)->field)) #define mWS_COUNTOF(array) (sizeof(array)/sizeof(array[0])) #if defined(VERSION_MAJOR) && (VERSION_MAJOR > 1 || (VERSION_MAJOR == 1 && VERSION_MINOR > 8)) #define OCT_MATCH_STRVAL_IDX(a,b,c) try_val_to_str_idx(a,b,c) #else #define OCT_MATCH_STRVAL_IDX(a,b,c) match_strval_idx(a,b,c) #define dissector_add_uint(a,b,c) dissector_add(a,b,c) #endif #endif /* __OCT_WS_MACRO_H__ */