]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/StoreClient.h
2 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 #ifndef SQUID_STORECLIENT_H
10 #define SQUID_STORECLIENT_H
13 #include "StoreIOBuffer.h"
14 #include "StoreIOState.h"
16 typedef void STCB(void *, StoreIOBuffer
); /* store callback */
24 virtual ~StoreClient () {}
26 virtual void created (StoreEntry
*newEntry
) = 0;
33 /* keep track each client receiving data from that particular StoreEntry */
37 CBDATA_CLASS(store_client
);
40 store_client(StoreEntry
*);
42 bool memReaderHasLowerOffset(int64_t) const;
45 void callback(ssize_t len
, bool error
= false);
46 void doCopy (StoreEntry
*e
);
47 void readHeader(const char *buf
, ssize_t len
);
48 void readBody(const char *buf
, ssize_t len
);
49 void copy(StoreEntry
*, StoreIOBuffer
, STCB
*, void *);
50 void dumpStats(MemBuf
* output
, int clientNumber
) const;
53 #if STORE_CLIENT_LIST_DEBUG
58 StoreEntry
*entry
; /* ptr to the parent StoreEntry, argh! */
59 StoreIOState::Pointer swapin_sio
;
64 bool copy_event_pending
;
69 void setDelayId(DelayId delay_id
);
73 /* Below here is private - do no alter outside storeClient calls */
74 StoreIOBuffer copyInto
;
77 bool moreToSend() const;
80 void scheduleDiskRead();
81 void scheduleMemRead();
84 void unpackHeader(char const *buf
, ssize_t len
);
89 /* Until we finish stuffing code into store_client */
94 Callback ():callback_handler(NULL
), callback_data(NULL
) {}
96 Callback (STCB
*, void *);
98 STCB
*callback_handler
;
103 void storeClientCopy(store_client
*, StoreEntry
*, StoreIOBuffer
, STCB
*, void *);
104 store_client
* storeClientListAdd(StoreEntry
* e
, void *data
);
105 int storeClientCopyPending(store_client
*, StoreEntry
* e
, void *data
);
106 int storeUnregister(store_client
* sc
, StoreEntry
* e
, void *data
);
107 int storePendingNClients(const StoreEntry
* e
);
108 int storeClientIsThisAClient(store_client
* sc
, void *someClient
);
110 #endif /* SQUID_STORECLIENT_H */