#ifndef SAR_MF_H_ #define SAR_MF_H_ /* Cesar project {{{ * * Copyright (C) 2007 Spidcom * * <<>> * * }}} */ /** * \file sar_mf.h * \brief header for the Mac Frame use. * \ingroup mac/sar/inc */ #include "mac/pbproc/pbproc.h" #include "common/defs/ethernet.h" #define SAR_MF_MFH_SIZE 2 #define SAR_MF_ATS_SIZE 4 #define SAR_MF_ICV_SIZE 4 #define SAR_MF_MAX_SIZE (SAR_MF_MFH_SIZE + SAR_MF_ATS_SIZE + ETH_PACKET_MAX_SIZE + SAR_MF_ICV_SIZE) #define SAR_MF_MIN_SIZE (SAR_MF_MFH_SIZE + SAR_MF_ATS_SIZE + ETH_PACKET_MIN_SIZE + SAR_MF_ICV_SIZE) #define SAR_DIV_BY_BLK_SIZE 9 /** * Get the type of the MF from the PB at the data adress plus the offset * * \param pb The first pb containing the MF. * \param offset the offset to start reading * \return MF type. */ uint mf_get_type (pb_t * pb, uint offset); /** * Test the existance of a MF at the address given by mf and return its length. * Will be used to determine if a complete MF is avaliable in the MFS. * Test if the MF start in the end of the PB by verifying the offset, if the MFH * is in two PBs. * * \param pb The first pb containing the MF. * \param offset the offset to start reading * \param payload_only request to return only the payload length if true. * * \return length of the paylod with the header and icv */ uint mf_get_length (pb_t *pb, uint offset, bool payload_length_only); /** * Calculate the number of PB used for the MF * * Depends of the mf_get_length function * * \param pb the first PB where the MF starts * \param offset the offset of the PB where the MF starts * \return the quantity of PBs */ uint mf_get_quantity_of_pb (pb_t *pb, uint offset); /** * gets the ATS of a MF in the address pointed by the PB plus the offset * * Depends of mf_get_type * * \param pb the first PB where the MF starts * \param offset the offset of the PB where the MF starts * \return the ATS of the MF. */ u32 mf_get_ats (pb_t *, uint offset); #endif /*SAR_MF_H_*/