1 
2 /* Web Polygraph       http://www.web-polygraph.org/
3  * Copyright 2003-2011 The Measurement Factory
4  * Licensed under the Apache License, Version 2.0 */
5 
6 #ifndef POLYGRAPH__RUNTIME_COMPOUNDXACTINFO_H
7 #define POLYGRAPH__RUNTIME_COMPOUNDXACTINFO_H
8 
9 #include "base/CompoundXactStat.h"
10 #include "base/AuthPhaseStat.h"
11 
12 class Xaction;
13 
14 // information shared among several transactions
15 class CompoundXactInfo {
16 	public:
17 		static CompoundXactInfo *Create(const int logCat);
18 		static void Abandon(CompoundXactInfo *&info);
19 		static void Share(CompoundXactInfo *info);
20 
21 		int logCat; // the logging "side" of individual transactions
22 		int ccLevel; // number of alive individual transactions
23 
24 		Size reqSize; // accumulative size of requests
25 		Size repSize; // accumulative size of responses
26 		Time startTime; // when the first individual transaction started
27 		Time finishTime; // when the last individual transaction finished
28 		unsigned int exchanges; // number of finished individual transactions
29 
30 		typedef enum { opNone, opIng, opDone } OpState; // operation progress
31 		OpState connectState; // HTTP CONNECT progress
32 		OpState proxyAuthState; // proxy authentication progress
33 		AuthPhaseStat::Scheme proxyStatAuth; // authentication state
34 
35 		// not expecting any new individual transactions
completed()36 		bool completed() const { return connectState != opIng && proxyAuthState != opIng; }
37 
38 		void record(CompoundXactStat &s) const;
39 		void reset();
40 
41 	protected:
42 		CompoundXactInfo();
43 		~CompoundXactInfo();
44 
45 	private:
46 		CompoundXactInfo *theNext;
47 		static CompoundXactInfo *TheFree;
48 };
49 
50 #endif
51