/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

File: octvocnet_pkt_swap.h	

Copyright (c) 2014 Octasic Inc. All rights reserved.	

Description:	

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation; either version 3 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 Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.	

Octasic_Release: OCTSDR-2G-01.08.05-B29-ALPHA (2014/08/14)	

\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/	
#ifndef __OCTVOCNET_PKT_SWAP_H__
#define __OCTVOCNET_PKT_SWAP_H__

#ifdef __cplusplus
extern "C" {
#endif

/*****************************  INCLUDE FILES  *******************************/
#include "octvc1_swap_hdrs.h"
#include "octvocnet_pkt.h"

/*********************************  MACROS  **********************************/


#if defined( _OCT_ENDIAN_TYPE_LE_ )
#define mOCTVOCNET_PKT_CTL_HEADER_SWAP( _f_pParms ){ 	tOCTVOCNET_PKT_CTL_HEADER * pOCTVOCNET_PKT_CTL_HEADER = (_f_pParms); \
	((tOCTVOCNET_PKT_CTL_HEADER *)pOCTVOCNET_PKT_CTL_HEADER)->ulDestFifoId = \
		mOCT_SWAP32_IF_LE(((tOCTVOCNET_PKT_CTL_HEADER *)pOCTVOCNET_PKT_CTL_HEADER)->ulDestFifoId); \
	((tOCTVOCNET_PKT_CTL_HEADER *)pOCTVOCNET_PKT_CTL_HEADER)->ulSourceFifoId = \
		mOCT_SWAP32_IF_LE(((tOCTVOCNET_PKT_CTL_HEADER *)pOCTVOCNET_PKT_CTL_HEADER)->ulSourceFifoId); \
	((tOCTVOCNET_PKT_CTL_HEADER *)pOCTVOCNET_PKT_CTL_HEADER)->ulSocketId = \
		mOCT_SWAP32_IF_LE(((tOCTVOCNET_PKT_CTL_HEADER *)pOCTVOCNET_PKT_CTL_HEADER)->ulSocketId); \
}
#else
#define mOCTVOCNET_PKT_CTL_HEADER_SWAP( pOCTVOCNET_PKT_CTL_HEADER )
#endif /* _OCT_ENDIAN_TYPE_LE_ */

#if defined( _OCT_ENDIAN_TYPE_LE_ )
#define mOCTVOCNET_PKT_DATA_HEADER_SWAP( _f_pParms ){ 	tOCTVOCNET_PKT_DATA_HEADER * pOCTVOCNET_PKT_DATA_HEADER = (_f_pParms); \
	{ mOCTVC1_HANDLE_SWAP( &((tOCTVOCNET_PKT_DATA_HEADER *)pOCTVOCNET_PKT_DATA_HEADER)->hLogicalObj ); }  \
	((tOCTVOCNET_PKT_DATA_HEADER *)pOCTVOCNET_PKT_DATA_HEADER)->ulLogicalObjPktPort = \
		mOCT_SWAP32_IF_LE(((tOCTVOCNET_PKT_DATA_HEADER *)pOCTVOCNET_PKT_DATA_HEADER)->ulLogicalObjPktPort); \
	((tOCTVOCNET_PKT_DATA_HEADER *)pOCTVOCNET_PKT_DATA_HEADER)->ulDestFifoId = \
		mOCT_SWAP32_IF_LE(((tOCTVOCNET_PKT_DATA_HEADER *)pOCTVOCNET_PKT_DATA_HEADER)->ulDestFifoId); \
}
#else
#define mOCTVOCNET_PKT_DATA_HEADER_SWAP( pOCTVOCNET_PKT_DATA_HEADER )
#endif /* _OCT_ENDIAN_TYPE_LE_ */

#if defined( _OCT_ENDIAN_TYPE_LE_ )
#define mOCTVOCNET_PKT_DATA_D_HEADER_SWAP( _f_pParms ){ 	tOCTVOCNET_PKT_DATA_D_HEADER * pOCTVOCNET_PKT_DATA_D_HEADER = (_f_pParms); \
	{ mOCTVOCNET_PKT_DATA_HEADER_SWAP( &((tOCTVOCNET_PKT_DATA_D_HEADER *)pOCTVOCNET_PKT_DATA_D_HEADER)->VocNetHeader ); }  \
	((tOCTVOCNET_PKT_DATA_D_HEADER *)pOCTVOCNET_PKT_DATA_D_HEADER)->ulReserved = \
		mOCT_SWAP32_IF_LE(((tOCTVOCNET_PKT_DATA_D_HEADER *)pOCTVOCNET_PKT_DATA_D_HEADER)->ulReserved); \
	((tOCTVOCNET_PKT_DATA_D_HEADER *)pOCTVOCNET_PKT_DATA_D_HEADER)->ul_Rtp_PktType_Pad_Offset = \
		mOCT_SWAP32_IF_LE(((tOCTVOCNET_PKT_DATA_D_HEADER *)pOCTVOCNET_PKT_DATA_D_HEADER)->ul_Rtp_PktType_Pad_Offset); \
	{ tOCT_UINT32 iOCTVOCNET_PKT_DATA_D_HEADER; \
	for( iOCTVOCNET_PKT_DATA_D_HEADER=0; \
		iOCTVOCNET_PKT_DATA_D_HEADER<(3);iOCTVOCNET_PKT_DATA_D_HEADER++ ) \
	((tOCTVOCNET_PKT_DATA_D_HEADER *)pOCTVOCNET_PKT_DATA_D_HEADER)->aulRtp[iOCTVOCNET_PKT_DATA_D_HEADER] = \
		mOCT_SWAP32_IF_LE(((tOCTVOCNET_PKT_DATA_D_HEADER *)pOCTVOCNET_PKT_DATA_D_HEADER)->aulRtp[iOCTVOCNET_PKT_DATA_D_HEADER]);}\
}
#else
#define mOCTVOCNET_PKT_DATA_D_HEADER_SWAP( pOCTVOCNET_PKT_DATA_D_HEADER )
#endif /* _OCT_ENDIAN_TYPE_LE_ */

#if defined( _OCT_ENDIAN_TYPE_LE_ )
#define mOCTVOCNET_PKT_DATA_F_HEADER_SWAP( _f_pParms ){ 	tOCTVOCNET_PKT_DATA_F_HEADER * pOCTVOCNET_PKT_DATA_F_HEADER = (_f_pParms); \
	{ mOCTVOCNET_PKT_DATA_HEADER_SWAP( &((tOCTVOCNET_PKT_DATA_F_HEADER *)pOCTVOCNET_PKT_DATA_F_HEADER)->VocNetHeader ); }  \
	((tOCTVOCNET_PKT_DATA_F_HEADER *)pOCTVOCNET_PKT_DATA_F_HEADER)->ulTimestamp = \
		mOCT_SWAP32_IF_LE(((tOCTVOCNET_PKT_DATA_F_HEADER *)pOCTVOCNET_PKT_DATA_F_HEADER)->ulTimestamp); \
	((tOCTVOCNET_PKT_DATA_F_HEADER *)pOCTVOCNET_PKT_DATA_F_HEADER)->ulSubType = \
		mOCT_SWAP32_IF_LE(((tOCTVOCNET_PKT_DATA_F_HEADER *)pOCTVOCNET_PKT_DATA_F_HEADER)->ulSubType); \
}
#else
#define mOCTVOCNET_PKT_DATA_F_HEADER_SWAP( pOCTVOCNET_PKT_DATA_F_HEADER )
#endif /* _OCT_ENDIAN_TYPE_LE_ */

#if defined( _OCT_ENDIAN_TYPE_LE_ )
#define mOCTVOCNET_PKT_DATA_B_HEADER_SWAP( _f_pParms ){ 	tOCTVOCNET_PKT_DATA_B_HEADER * pOCTVOCNET_PKT_DATA_B_HEADER = (_f_pParms); \
	{ mOCTVOCNET_PKT_DATA_HEADER_SWAP( &((tOCTVOCNET_PKT_DATA_B_HEADER *)pOCTVOCNET_PKT_DATA_B_HEADER)->VocNetHeader ); }  \
	((tOCTVOCNET_PKT_DATA_B_HEADER *)pOCTVOCNET_PKT_DATA_B_HEADER)->ulNumCells = \
		mOCT_SWAP32_IF_LE(((tOCTVOCNET_PKT_DATA_B_HEADER *)pOCTVOCNET_PKT_DATA_B_HEADER)->ulNumCells); \
}
#else
#define mOCTVOCNET_PKT_DATA_B_HEADER_SWAP( pOCTVOCNET_PKT_DATA_B_HEADER )
#endif /* _OCT_ENDIAN_TYPE_LE_ */

#if defined( _OCT_ENDIAN_TYPE_LE_ )
#define mOCTVOCNET_PKT_DATA_C_HEADER_SWAP( _f_pParms ){ 	tOCTVOCNET_PKT_DATA_C_HEADER * pOCTVOCNET_PKT_DATA_C_HEADER = (_f_pParms); \
	{ mOCTVOCNET_PKT_DATA_HEADER_SWAP( &((tOCTVOCNET_PKT_DATA_C_HEADER *)pOCTVOCNET_PKT_DATA_C_HEADER)->VocNetHeader ); }  \
}
#else
#define mOCTVOCNET_PKT_DATA_C_HEADER_SWAP( pOCTVOCNET_PKT_DATA_C_HEADER )
#endif /* _OCT_ENDIAN_TYPE_LE_ */

#if defined( _OCT_ENDIAN_TYPE_LE_ )
#define mOCTVOCNET_PKT_DATA_E_HEADER_SWAP( _f_pParms ){ 	tOCTVOCNET_PKT_DATA_E_HEADER * pOCTVOCNET_PKT_DATA_E_HEADER = (_f_pParms); \
	{ mOCTVOCNET_PKT_DATA_HEADER_SWAP( &((tOCTVOCNET_PKT_DATA_E_HEADER *)pOCTVOCNET_PKT_DATA_E_HEADER)->VocNetHeader ); }  \
	((tOCTVOCNET_PKT_DATA_E_HEADER *)pOCTVOCNET_PKT_DATA_E_HEADER)->ul_Uu_Cp = \
		mOCT_SWAP32_IF_LE(((tOCTVOCNET_PKT_DATA_E_HEADER *)pOCTVOCNET_PKT_DATA_E_HEADER)->ul_Uu_Cp); \
}
#else
#define mOCTVOCNET_PKT_DATA_E_HEADER_SWAP( pOCTVOCNET_PKT_DATA_E_HEADER )
#endif /* _OCT_ENDIAN_TYPE_LE_ */

#if defined( _OCT_ENDIAN_TYPE_LE_ )
#define mOCTVOCNET_PKT_DATA_R_HEADER_SWAP( _f_pParms ){ 	tOCTVOCNET_PKT_DATA_R_HEADER * pOCTVOCNET_PKT_DATA_R_HEADER = (_f_pParms); \
	{ mOCTVOCNET_PKT_HEADER_SWAP( &((tOCTVOCNET_PKT_DATA_R_HEADER *)pOCTVOCNET_PKT_DATA_R_HEADER)->VocNetHeader ); }  \
	((tOCTVOCNET_PKT_DATA_R_HEADER *)pOCTVOCNET_PKT_DATA_R_HEADER)->ulForwardPkt_BridgeMacDstAddrHi = \
		mOCT_SWAP32_IF_LE(((tOCTVOCNET_PKT_DATA_R_HEADER *)pOCTVOCNET_PKT_DATA_R_HEADER)->ulForwardPkt_BridgeMacDstAddrHi); \
	((tOCTVOCNET_PKT_DATA_R_HEADER *)pOCTVOCNET_PKT_DATA_R_HEADER)->ulBridgeMacDstAddrLow = \
		mOCT_SWAP32_IF_LE(((tOCTVOCNET_PKT_DATA_R_HEADER *)pOCTVOCNET_PKT_DATA_R_HEADER)->ulBridgeMacDstAddrLow); \
	((tOCTVOCNET_PKT_DATA_R_HEADER *)pOCTVOCNET_PKT_DATA_R_HEADER)->ulBridgeMacSrcAddrHi = \
		mOCT_SWAP32_IF_LE(((tOCTVOCNET_PKT_DATA_R_HEADER *)pOCTVOCNET_PKT_DATA_R_HEADER)->ulBridgeMacSrcAddrHi); \
	((tOCTVOCNET_PKT_DATA_R_HEADER *)pOCTVOCNET_PKT_DATA_R_HEADER)->ulBridgeMacSrcAddrLow = \
		mOCT_SWAP32_IF_LE(((tOCTVOCNET_PKT_DATA_R_HEADER *)pOCTVOCNET_PKT_DATA_R_HEADER)->ulBridgeMacSrcAddrLow); \
}
#else
#define mOCTVOCNET_PKT_DATA_R_HEADER_SWAP( pOCTVOCNET_PKT_DATA_R_HEADER )
#endif /* _OCT_ENDIAN_TYPE_LE_ */

#if defined( _OCT_ENDIAN_TYPE_LE_ )
#define mOCTVOCNET_PKT_DATA_Q_HEADER_SWAP( _f_pParms ){ 	tOCTVOCNET_PKT_DATA_Q_HEADER * pOCTVOCNET_PKT_DATA_Q_HEADER = (_f_pParms); \
	{ mOCTVOCNET_PKT_HEADER_SWAP( &((tOCTVOCNET_PKT_DATA_Q_HEADER *)pOCTVOCNET_PKT_DATA_Q_HEADER)->VocNetHeader ); }  \
	{ tOCT_UINT32 iOCTVOCNET_PKT_DATA_Q_HEADER; \
	for( iOCTVOCNET_PKT_DATA_Q_HEADER=0; \
		iOCTVOCNET_PKT_DATA_Q_HEADER<(3);iOCTVOCNET_PKT_DATA_Q_HEADER++ ) \
	((tOCTVOCNET_PKT_DATA_Q_HEADER *)pOCTVOCNET_PKT_DATA_Q_HEADER)->ausInfo[iOCTVOCNET_PKT_DATA_Q_HEADER] = \
		mOCT_SWAP16_IF_LE(((tOCTVOCNET_PKT_DATA_Q_HEADER *)pOCTVOCNET_PKT_DATA_Q_HEADER)->ausInfo[iOCTVOCNET_PKT_DATA_Q_HEADER]);} \
}
#else
#define mOCTVOCNET_PKT_DATA_Q_HEADER_SWAP( pOCTVOCNET_PKT_DATA_Q_HEADER )
#endif /* _OCT_ENDIAN_TYPE_LE_ */

#ifdef __cplusplus
}

#endif

#endif /* __OCTVOCNET_PKT_SWAP_H__ */
