//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project / uni
//
//File: unipducoder.h
//
//Version: $Revision: 1.5 $
//
//State: $State: Exp $
//
//Date: $Date: 1999/01/20 08:53:19 $
//
//Organisation:
//      Helsinki University of Technology
//      Laboratory of Telecommunications Software and Multimedia
// 
//Author:
//      Sami Raatikainen
//
//Description:
//      Base class for encoding and decoding primitives to/from uni-pdu
//      frames.
//
//Copyright:
//      Copyright 1999 Helsinki University of Technology
//      ALL RIGHTS RESERVED BETWEEN JANUARY 1996 AND JUNE 1999.
//
//Licence:
//
//
//History:
//

#ifndef __UNI_UNIPDUCODER_H__
#define __UNI_UNIPDUCODER_H__

#include "pf/types.h"
#include "pf/bytes.h"
#include "protocol/sig/pducoder.h"
#include "unicoordprotocol.h"

// Limits for pdu/ie size
const pfUlong uniPduMinimumSize = 9;

// Standard position for message type identifier within pdu.
const pfUlong uniMessageTypePosition = 5;

// Call Reference Flag bit position and mask
const pfUlong uniCallReferenceFlagBitPosition = 23;
const pfUlong uniCallReferenceFlagBitMask = 0x800000;

// Protocol Discriminator for UNI pdus
const pfByte uniProtocolDiscriminator = B0000_1001;

class uniPduCoder : public pduCoder
{
    public:
        virtual ~uniPduCoder(void);
        static pfMessenger *create(
            pfFrame &frame_, 
            uniCoOrdProtocol *protocol_);

    protected:
        uniPduCoder(pfUlong PDUtype_);
        uniPduCoder(void);

        virtual void decodeHeader(pfFrame &frame_, pfMessenger *msg_);
        virtual void encodeHeader(pfFrame &frame_, pfMessenger *msg_);

        enum MsgType
        {
            uniMsgAlerting               = B0000_0001,
            uniMsgCallProceeding         = B0000_0010,
            uniMsgSetup                  = B0000_0101,
            uniMsgConnect                = B0000_0111,
            uniMsgConnectAck             = B0000_1111,
            uniMsgRelease                = B0100_1101,
            uniMsgReleaseComplete        = B0101_1010,
            uniMsgRestart                = B0100_0110,
            uniMsgRestartAck             = B0100_1110,
            uniMsgNotify                 = B0110_1110,
            uniMsgStatus                 = B0111_1101,
            uniMsgStatusEnquiry          = B0111_0101,
            uniMsgAddParty               = B1000_0000,
            uniMsgAddPartyAck            = B1000_0001,
            uniMsgAddPartyReject         = B1000_0010,
            uniMsgDropParty              = B1000_0011,
            uniMsgDropPartyAck           = B1000_0100
        };
};

#endif // __UNI_UNIPDUCODER_H__
