//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project / SCCP protocol
//
//File: sccppdus.h
//
//Version: $Revision: 1.10 $
//
//State: $State: Exp $
//
//Date: $Date: 1998/10/19 18:14:50 $
//
//Organisation:
//      Helsinki University of Technology
//      Laboratory of Telecommunications Software and Multimedia
//
//Author:
//      Timo Pärnänen
//
//Description:
//      Class definitions for SCCP Protocol Data Units (PDU).
//
//Copyright:
//
//
//Licence:
//
//
//History: 

#ifndef __SCCP_PDUS_H__
#define __SCCP_PDUS_H__

#include "pf/storage.h"
#include "pf/messenge.h"

class pfFrame;
class pfState;
class pfProtocol;
class mtpTRANSFERind;
class sccpN_UNITDATAreq;

//
//Class: sccpPdu
//
//Description:
//    Base class for all SCCP PDUs.
//

class sccpPdu : public pfMessenger
{
    public:
        static sccpPdu *createPdu(mtpTRANSFERind *messenger_);
        virtual ~sccpPdu(void);
        
        virtual bool decode(void) = 0;
        virtual pfFrame encode(void) = 0;

        bool routeOnGT(void);

    protected:
        sccpPdu(void);
        bool checkMandatoryVariableField(pfUlong start_,
                                              pfUlong &variableLength_,
                                              pfUlong min_ = 0,
                                              pfUlong max_ = 0);
        pfStorage decodeAddress(pfUlong offSet_, pfUlong length_);      
        void encodeAddress(pfStorage &address_);
        
        pfFrame _frame;
};

//
//Class: sccpUDTpdu
//
//Description:
//    Unitdata (UDT) PDU used to send data in connectionless mode.
//

class sccpUDTpdu : public sccpPdu
{
    public:
        static sccpUDTpdu *createUDTpdu(sccpN_UNITDATAreq *messenger_);
        sccpUDTpdu(void);
        virtual ~sccpUDTpdu(void);

        virtual void apply(pfState *state_, pfProtocol *protocol_);
        virtual bool decode(void);
        virtual pfFrame encode(void);
};

#endif // __SCCP_PDUS_H__
