+/*
+ * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
#ifndef SQUID_COMM_TCPACCEPTOR_H
#define SQUID_COMM_TCPACCEPTOR_H
+#include "anyp/forward.h"
#include "base/AsyncJob.h"
#include "base/CbcPointer.h"
#include "base/Subscription.h"
+#include "comm/Flag.h"
#include "comm/forward.h"
-#include "comm_err_t.h"
class CommCloseCbParams;
*/
class TcpAcceptor : public AsyncJob
{
+ CBDATA_CLASS(TcpAcceptor);
+
public:
typedef CbcPointer<Comm::TcpAcceptor> Pointer;
public:
TcpAcceptor(const Comm::ConnectionPointer &conn, const char *note, const Subscription::Pointer &aSub);
+ TcpAcceptor(const AnyP::PortCfgPointer &listenPort, const char *note, const Subscription::Pointer &aSub);
/** Subscribe a handler to receive calls back about new connections.
* Unsubscribes any existing subscribed handler.
void acceptNext();
/// Call the subscribed callback handler with details about a new connection.
- void notify(const comm_err_t flag, const Comm::ConnectionPointer &details) const;
+ void notify(const Comm::Flag flag, const Comm::ConnectionPointer &details) const;
/// errno code of the last accept() or listen() action if one occurred.
int errcode;
/// Reserved for read-only use.
ConnectionPointer conn;
+ /// configuration details of the listening port (if provided)
+ AnyP::PortCfgPointer listenPort_;
+
/// listen socket closure handler
AsyncCall::Pointer closer_;
static void doAccept(int fd, void *data);
void acceptOne();
- comm_err_t oldAccept(Comm::ConnectionPointer &details);
+ Comm::Flag oldAccept(Comm::ConnectionPointer &details);
void setListen();
void handleClosure(const CommCloseCbParams &io);
-
- CBDATA_CLASS2(TcpAcceptor);
};
} // namespace Comm
#endif /* SQUID_COMM_TCPACCEPTOR_H */
+