//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project / MTP3 protocol 
//
//File: mtp3state.cpp
//
//Version: $Revision: 1.9 $
//
//State: $State: Exp $
//
//Date: $Date: 1998/04/20 08:36:01 $
//
//Organisation:
//      Helsinki University of Technology
//      Laboratory of Telecommunications Software and Multimedia
//
//Author:
//      Petteri Koponen
//
//Description:
//      See the corresponding header file.
//
//Copyright:
//
//
//Licence:
//
//
//History:

#include "pf/frame.h"
#include "mtp3defs.h"
#include "protocol/mtp3/mtp3state.h"

//Function: getServiceIndicator
//
//Member-Of: mtp3State
//
//Parameters: const pfFrame& frame_
//            ss7ServiceIndicator &serviceIndicator_
//
//Returns: pfUlong
//
//Description:
//      Gets the service indicator from the frame, but doesn't alter the
//      frame. Returns 0, if OK, otherwise the error coding status.
//

pfUlong mtp3State :: getServiceIndicator(const pfFrame &frame_,
                                         pfUlong &serviceIndicator_)
{
    pfUlong status = MTP3_CODING_OK;
    if (frame_.length() <= MTP3_SERVICE_INDICATOR_OFFSET)
    {
	status = MTP3_CODING_FRAME_TOO_SHORT;
    }
    else
    {
	serviceIndicator_ = (frame_.read(MTP3_SERVICE_INDICATOR_OFFSET) &
			     MTP3_4_BITS);
    }
    return status;
}
