#ifndef SQUID_COMM_UDPOPENDIALER_H
#define SQUID_COMM_UDPOPENDIALER_H

#include "ipc/StartListening.h"

namespace Comm
{

/// dials a UDP port-opened call
class UdpOpenDialer: public CallDialer,
        public Ipc::StartListeningCb
{
public:
    typedef void (*Handler)(const Comm::ConnectionPointer &conn, int errNo);
    UdpOpenDialer(Handler aHandler): handler(aHandler) {}

    virtual void print(std::ostream &os) const { startPrint(os) << ')'; }
    virtual bool canDial(AsyncCall &) const { return true; }
    virtual void dial(AsyncCall &) { (handler)(conn, errNo); }

public:
    Handler handler;
};

} // namespace Comm

#endif /* SQUID_COMM_UDPOPENDIALER_H */
