/*
- * $Id$
- * DEBUG: section 93 eCAP Interface
+ * Copyright (C) 1996-2020 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.
*/
+/* DEBUG: section 93 eCAP Interface */
+
#ifndef SQUID_ECAP_SERVICE_REP_H
#define SQUID_ECAP_SERVICE_REP_H
-#include "adaptation/Service.h"
#include "adaptation/forward.h"
+#include "adaptation/Service.h"
#include <libecap/common/forward.h>
#include <libecap/common/memory.h>
class ServiceRep : public Adaptation::Service
{
public:
- ServiceRep(ServiceConfigPointer aConfig);
+ explicit ServiceRep(const ServiceConfigPointer &aConfig);
virtual ~ServiceRep();
typedef libecap::shared_ptr<libecap::adapter::Service> AdapterService;
+ /* Adaptation::Service API */
virtual void finalize();
-
virtual bool probed() const;
virtual bool up() const;
-
- Adaptation::Initiate *makeXactLauncher(HttpMsg *virginHeader, HttpRequest *virginCause);
-
- // the methods below can only be called on an up() service
- virtual bool wantsUrl(const String &urlPath) const;
-
- // called by transactions to report service failure
+ virtual Adaptation::Initiate *makeXactLauncher(Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp);
+ virtual bool wantsUrl(const SBuf &urlPath) const;
virtual void noteFailure();
-
virtual const char *status() const;
-
virtual void detach();
virtual bool detached() const;
+protected:
+ void tryConfigureAndStart();
+ bool handleFinalizeFailure(const char *error);
+
private:
AdapterService theService; // the actual adaptation service we represent
bool isDetached;
};
/// register loaded eCAP module service
-extern void RegisterAdapterService(const ServiceRep::AdapterService& adapterService);
+void RegisterAdapterService(const ServiceRep::AdapterService& adapterService);
/// unregister loaded eCAP module service by service uri
-extern void UnregisterAdapterService(const String& serviceUri);
+void UnregisterAdapterService(const String& serviceUri);
/// returns loaded eCAP module service by service uri
-extern ServiceRep::AdapterService FindAdapterService(const String& serviceUri);
+ServiceRep::AdapterService FindAdapterService(const String& serviceUri);
/// check for loaded eCAP services without matching ecap_service in squid.conf
-extern void CheckUnusedAdapterServices(const Services& services);
+void CheckUnusedAdapterServices(const Services& services);
} // namespace Ecap
} // namespace Adaptation
#endif /* SQUID_ECAP_SERVICE_REP_H */
+