#define SQUID_CACHEMANAGER_H
#include "squid.h"
+#include <list>
/**
\defgroup CacheManagerAPI Cache Manager API
unsigned int pw_req:1;
unsigned int atomic:1;
} flags;
+ virtual ~CacheManagerAction();
+ CacheManagerAction(char const *anAction, char const *aDesc, unsigned int isPwReq, unsigned int isAtomic);
+
CacheManagerAction *next;
- virtual ~CacheManagerAction() { }
};
+/**
+ \ingroup CacheManagerAPI
+ * wrapper allowing c-style callbacks to be used. Arguments are supposed to
+ * managed by the caller, as they will be copied over by the constructor.
+ */
class CacheManagerActionLegacy : public CacheManagerAction {
public:
OBJH *handler;
virtual void run (StoreEntry *sentry);
+ CacheManagerActionLegacy(char const *anAction, char const *aDesc, unsigned int isPwReq, unsigned int isAtomic, OBJH *aHandler);
};
class CacheManagerShutdownAction : public CacheManagerAction {
virtual void run (StoreEntry *sentry);
};
-/// \ingroup CacheManagerInternal
-typedef struct
-{
- StoreEntry *entry;
- char *action;
- char *user_name;
- char *passwd;
-} cachemgrStateData;
+class CacheManagerActionList : public std::list<CacheManagerAction> {
+
+};
/// \ingroup CacheManagerInternal
typedef struct
}
assert (strstr (" ", action) == NULL);
- a = new CacheManagerActionLegacy;
- a->action = xstrdup(action);
- a->desc = xstrdup(desc);
- a->handler = handler;
- a->flags.pw_req = pw_req_flag;
- a->flags.atomic = atomic;
- a->next=0;
+ a = new CacheManagerActionLegacy(action,desc,pw_req_flag,atomic,handler);
+ a->next=0;
for (A = &ActionTable; *A; A = &(*A)->next);
*A = a;
handler(sentry);
}
+CacheManagerAction::CacheManagerAction(char const *anAction, char const *aDesc, unsigned int isPwReq, unsigned int isAtomic)
+{
+ flags.pw_req = isPwReq;
+ flags.atomic = isAtomic;
+ action = xstrdup (anAction);
+ desc = xstrdup (aDesc);
+}
+CacheManagerAction::~CacheManagerAction() {
+ xfree(action);
+ xfree(desc);
+}
+
+CacheManagerActionLegacy::CacheManagerActionLegacy(char const *anAction, char const *aDesc, unsigned int isPwReq, unsigned int isAtomic, OBJH *aHandler) : CacheManagerAction(anAction, aDesc, isPwReq, isAtomic), handler(aHandler)
+{
+}