Also includes some Packable API polishing. No logical changes.
/* DEBUG: section 68 HTTP Content-Range Header */
#include "squid.h"
+#include "base/Packable.h"
#include "Debug.h"
#include "enums.h"
#include "HttpHdrContRange.h"
#define SQUID_HTTPHEADERRANGE_H
#include "mem/forward.h"
-#include "Packer.h"
#include "Range.h"
#include "SquidString.h"
#include <vector>
class HttpReply;
+class Packable;
+
/* http byte-range-spec */
class HttpHdrRangeSpec
neighbors.cc \
Notes.h \
Notes.cc \
- Packer.cc \
- Packer.h \
Parsing.cc \
Parsing.h \
$(XPROF_STATS_SOURCE) \
mime_header.cc \
Notes.h \
Notes.cc \
- Packer.cc \
- Packer.h \
SquidString.h \
SquidTime.h \
$(SBUF_SOURCE) \
SquidList.h \
SquidList.cc \
mem_node.cc \
- Packer.cc \
Parsing.cc \
SquidMath.cc \
StatCounters.cc \
neighbors.cc \
Notes.cc \
Notes.h \
- Packer.cc \
Parsing.cc \
pconn.cc \
peer_digest.cc \
mem_node.cc \
Notes.h \
Notes.cc \
- Packer.cc \
Parsing.cc \
refresh.h \
refresh.cc \
neighbors.cc \
Notes.cc \
Notes.h \
- Packer.cc \
Parsing.cc \
pconn.cc \
peer_digest.cc \
neighbors.cc \
Notes.cc \
Notes.h \
- Packer.cc \
Parsing.cc \
pconn.cc \
peer_digest.cc \
neighbors.cc \
Notes.cc \
Notes.h \
- Packer.cc \
Parsing.cc \
peer_digest.cc \
peer_proxy_negotiate_auth.h \
neighbors.cc \
Notes.cc \
Notes.h \
- Packer.cc \
Parsing.cc \
pconn.cc \
peer_digest.cc \
MemObject.cc \
Notes.h \
Notes.cc \
- Packer.cc \
Parsing.cc \
RemovalPolicy.cc \
refresh.h \
ClientInfo.h \
MemBuf.cc \
HttpHdrContRange.cc \
- Packer.cc \
HttpHeaderFieldStat.h \
HttpHdrCc.h \
HttpHdrCc.cc \
mem_node.cc \
Notes.h \
Notes.cc \
- Packer.cc \
Parsing.cc \
RemovalPolicy.cc \
RequestFlags.cc \
neighbors.cc \
Notes.h \
Notes.cc \
- Packer.cc \
Parsing.cc \
pconn.cc \
peer_digest.cc \
+++ /dev/null
-/*
- * 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.
- */
-
-/* DEBUG: section 60 Generic Data Packer */
-
-#include "squid.h"
-#include "Packer.h"
-#include "Store.h"
-
-/*
- * We do have one potential problem here. Both append_f and vprintf_f types
- * cannot match real functions precisely (at least because of the difference in
- * the type of the first parameter). Thus, we have to use type cast. If somebody
- * changes the prototypes of real functions, Packer will not notice that because
- * of the type cast.
- *
- * Solution: we use the constants below to *hard code* current prototypes of
- * real functions. If real prototypes change, these constants will produce a
- * warning (e.g., "warning: assignment from incompatible pointer type").
- */
-
-static void
-storeEntryAppend(StoreEntry *e, const char *buf, int len)
-{
- e->append(buf, len);
-}
-
-/* append()'s */
-static void (*const store_append) (StoreEntry *, const char *, int) = &storeEntryAppend;
-
-/* vprintf()'s */
-static void (*const store_vprintf) (StoreEntry *, const char *, va_list ap) = &storeAppendVPrintf;
-
-/* init/clean */
-
-/* init with this to forward data to StoreEntry */
-void
-packerToStoreInit(Packer * p, StoreEntry * e)
-{
- assert(p && e);
- p->append_ = (append_f) store_append;
- p->packer_vprintf = (vprintf_f) store_vprintf;
- p->real_handler = e;
- e->buffer();
-}
-
-Packer::~Packer()
-{
- if (append_ == (append_f) store_append && real_handler)
- static_cast<StoreEntry*>(real_handler)->flush();
-
- /* it is not really necessary to do this, but, just in case... */
- append_ = NULL;
- packer_vprintf = NULL;
- real_handler = NULL;
-}
-
-void
-Packer::append(const char *buf, int sz)
-{
- assert(real_handler && append_);
- append_(real_handler, buf, sz);
-}
-
-void
-Packer::vappendf(const char *fmt, va_list args)
-{
- assert(real_handler && packer_vprintf);
- packer_vprintf(real_handler, fmt, args);
-}
-
+++ /dev/null
-/*
- * 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_PACKER_H
-#define SQUID_PACKER_H
-
-#include "base/Packable.h"
-
-/* see Packer.cc for description */
-class Packer;
-
-/* a common objPackInto interface; used by debugObj */
-typedef void (*ObjPackMethod) (void *obj, Packable * p);
-
-/* append/vprintf's for Packer */
-typedef void (*append_f) (void *, const char *buf, int size);
-typedef void (*vprintf_f) (void *, const char *fmt, va_list args);
-
-class Packer : public Packable
-{
-
-public:
- virtual ~Packer();
-
- /* Packable API */
- virtual void append(const char *buf, int size);
- virtual void vappendf(const char *fmt, va_list ap);
-
- /* protected, use interface functions instead */
- append_f append_;
- vprintf_f packer_vprintf;
- void *real_handler; /* first parameter to real append and vprintf */
-};
-
-#endif /* SQUID_PACKER_H */
-
* storeAppend. Packable buffer objects retain the data such that it can be
* flushed later to Comm::Write.
*
- * Thus, one can write just one function that will take a Packer* pointer
+ * Thus, one can write just one function that will take a Packable object
* and either "pack" things for Comm::Write or "append" things to Store,
* depending on actual Packable object supplied.
*/
vappendf(fmt, args);
va_end(args);
}
-#if 0
- /*
- * \note we use Printf instead of printf so the compiler won't
- * think we're calling the libc printf()
- */
- void Printf(const char *fmt,...) PRINTF_FORMAT_ARG2
- {
- va_list args;
- va_start(args, fmt);
- vappendf(fmt, args);
- va_end(args);
- }
-#endif
/** Append operation, with vsprintf(3)-style arguments.
*
/* DEBUG: section 57 HTTP Status-line */
#include "squid.h"
+#include "base/Packable.h"
#include "Debug.h"
#include "http/StatusLine.h"
-#include "Packer.h"
void
Http::StatusLine::init()
/// retrieve the reason string for this status line
const char *reason() const;
- /// pack fields using Packer
- void packInto(Packable * p) const;
+ /// pack fields into a Packable object
+ void packInto(Packable *) const;
/**
* Parse a buffer and fill internal structures;
void storeFsDone(void) STUB
void storeReplAdd(const char *, REMOVALPOLICYCREATE *) STUB
void destroyStoreEntry(void *) STUB
-// in Packer.cc !? void packerToStoreInit(Packer * p, StoreEntry * e) STUB
void storeGetMemSpace(int size) STUB
#ifndef SQUID_TOOLS_H_
#define SQUID_TOOLS_H_
-#include "Packer.h"
#include "SBuf.h"
#include "SquidString.h"
#include "typedefs.h"
void setUmask(mode_t mask);
void strwordquote(MemBuf * mb, const char *str);
+class Packable;
+
+/* a common objPackInto interface; used by debugObj */
+typedef void (*ObjPackMethod) (void *obj, Packable * p);
+
/* packs, then prints an object using debugs() */
void debugObj(int section, int level, const char *label, void *obj, ObjPackMethod pm);