| 
		| Source: ../../libxipc/xrl_pf.hh |  |  
 |  | 
// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
// Copyright (c) 2001-2003 International Computer Science Institute
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software")
// to deal in the Software without restriction, subject to the conditions
// listed in the XORP LICENSE file. These conditions include: you must
// preserve this copyright notice, and you cannot mention the copyright
// holders in advertising related to the Software without their permission.
// The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
// notice is a summary of the XORP LICENSE file; the license in that file is
// legally binding.
// $XORP: xorp/libxipc/xrl_pf.hh,v 1.17 2003/06/19 00:44:43 hodson Exp $
// XRL Protocol Family Header
#ifndef __LIBXIPC_XRL_PF_HH__
#define __LIBXIPC_XRL_PF_HH__
#include <string>
#include "xrl.hh"
#include "xuid.hh"
#include "libxorp/eventloop.hh"
#include "libxorp/timer.hh"
#include "libxorp/selector.hh"
#include "libxorp/exceptions.hh"
class XrlPFConstructorError : public XorpReasonedException
{
public:
    XrlPFConstructorError(const char* file, size_t line, const string& reason)
	: XorpReasonedException("XrlPFConstructorError", file, line, reason)
    {}
};
class XrlDispatcher;
class XrlPFListener
{
public:
    XrlPFListener(EventLoop& e, XrlDispatcher* d = 0)
	: _eventloop(e), _dispatcher(d) {}
    virtual ~XrlPFListener() {}
    virtual const char*	address() const = 0;
    virtual const char*	protocol() const = 0;
    inline bool set_dispatcher(const XrlDispatcher* d);
    inline const XrlDispatcher* dispatcher() const { return _dispatcher; }
    EventLoop& eventloop() const { return _eventloop; }
protected:
    EventLoop& _eventloop;
    const XrlDispatcher* _dispatcher;
};
// ----------------------------------------------------------------------------
// XrlPFSender
class XrlPFSender
{
public:
    XrlPFSender(EventLoop& e, const char* address = "")
	: _eventloop(e), _address(address) {}
    virtual ~XrlPFSender() {}
    typedef
    XorpCallback2<void, const XrlError&, XrlArgs*>::RefPtr
    SendCallback;
    virtual void send(const Xrl& x, const SendCallback& cb) = 0;
    virtual bool sends_pending() const = 0;
    const string& address() const { return _address; }
    EventLoop& eventloop() const { return _eventloop; }
protected:
    EventLoop& _eventloop;
    string _address;
};
// ----------------------------------------------------------------------------
// Inline XrlPFListener Methods
inline bool
XrlPFListener::set_dispatcher(const XrlDispatcher* d)
{
    if (_dispatcher == 0) {
	_dispatcher = d;
	return true;
    }
    return false;
}
#endif // __LIBXIPC_XRL_PF_HH__
	
	| Generated by: pavlin on possum.icir.org on Thu Aug 28 12:52:06 2003, using kdoc 2.0a54+XORP. |