//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project / pf
//
//File: udpsockdev.h
//
//Version: $Revision: 1.3 $
//
//State: $State: Exp $
//
//Date: $Date: 1998/10/19 08:46:03 $
//
//Organisation:
//      Helsinki University of Technology
//      Laboratory of Telecommunications Software and Multimedia
//
//Author:
//      Juhana Räsänen
//
//Description:
//      OVOPS++ device class for IP UDP sockets.
//    Class that implements UDP socket functionality on top of base
//    OVOPS++ pfDevice class. Only openDevice method needs to be defined
//    as other functionality in base class works for udp sockets.
//
//Copyright:
//      Copyright 1999 Helsinki University of Technology
//      ALL RIGHTS RESERVED BETWEEN JANUARY 1996 AND JUNE 1999.
//
//Licence:
//
//
//History: 
//
//

#ifndef __PF_UDPSOCKET_H__
#define __PF_UDPSOCKET_H__

#include "pf/device.h"
#include <string>

class pfUDPsocket : public pfDevice
{
    public:
        explicit pfUDPsocket(pfUlong bufferSize_);
        virtual ~pfUDPsocket(void);
        virtual bool openDevice(string remote_hostname_,
                                     int local_port_,
                                     int remote_port_);
        virtual void setAddr(const struct sockaddr_in &addr_);
        virtual const struct sockaddr_in &getAddr(void) const;

    protected:
        void freeBuffers(void);
        virtual int readFromSocket(void);
        virtual int writeToSocket(char *start_);

	struct sockaddr_in _addr;
	bool _isAddressLocked;
};

#endif  // __PF_UDPSOCKET_H__

