unsigned int Ipc::Forwarder::LastRequestId = 0;
Ipc::Forwarder::Forwarder(Request::Pointer aRequest, double aTimeout):
- AsyncJob("Ipc::Forwarder"),
- request(aRequest), timeout(aTimeout)
+ AsyncJob("Ipc::Forwarder"),
+ request(aRequest), timeout(aTimeout)
{
debugs(54, 5, HERE);
}
Ipc::Inquirer::Inquirer(Request::Pointer aRequest, const StrandCoords& coords,
double aTimeout):
- AsyncJob("Ipc::Inquirer"),
- request(aRequest), strands(coords), pos(strands.begin()), timeout(aTimeout)
+ AsyncJob("Ipc::Inquirer"),
+ request(aRequest), strands(coords), pos(strands.begin()), timeout(aTimeout)
{
debugs(54, 5, HERE);
public:
Request(int aRequestorId, unsigned int aRequestId):
- requestorId(aRequestorId), requestId(aRequestId) {}
+ requestorId(aRequestorId), requestId(aRequestId) {}
virtual void pack(TypedMsgHdr& msg) const = 0; ///< prepare for sendmsg()
virtual Pointer clone() const = 0; ///< returns a copy of this
public:
explicit Response(unsigned int aRequestId):
- requestId(aRequestId) {}
+ requestId(aRequestId) {}
virtual void pack(TypedMsgHdr& msg) const = 0; ///< prepare for sendmsg()
virtual Pointer clone() const = 0; ///< returns a copy of this
}
Mgr::Request::Request(const Request& request):
- Ipc::Request(request.requestorId, request.requestId),
- fd(request.fd), params(request.params)
+ Ipc::Request(request.requestorId, request.requestId),
+ fd(request.fd), params(request.params)
{
}
Mgr::Request::Request(const Ipc::TypedMsgHdr& msg):
- Ipc::Request(0, 0)
+ Ipc::Request(0, 0)
{
msg.checkType(Ipc::mtCacheMgrRequest);
msg.getPod(requestorId);
}
Mgr::Response::Response(const Response& response):
- Ipc::Response(response.requestId), action(response.action)
+ Ipc::Response(response.requestId), action(response.action)
{
}
Mgr::Response::Response(const Ipc::TypedMsgHdr& msg):
- Ipc::Response(0)
+ Ipc::Response(0)
{
msg.checkType(Ipc::mtCacheMgrResponse);
msg.getPod(requestId);
Must(varCount() == pdu.varCount());
aggrCount++;
for (variable_list* p_aggr = variables, *p_var = pdu.variables; p_var != NULL;
- p_aggr = p_aggr->next_variable, p_var = p_var->next_variable)
- {
+ p_aggr = p_aggr->next_variable, p_var = p_var->next_variable) {
Must(p_aggr != NULL);
Var& aggr = static_cast<Var&>(*p_aggr);
Var& var = static_cast<Var&>(*p_var);
aggr.setName(var.getName());
aggr.copyValue(var);
} else {
- switch(snmpAggrType(aggr.name, aggr.name_length))
- {
+ switch (snmpAggrType(aggr.name, aggr.name_length)) {
case atSum:
case atAverage:
// The mean-average division is done later
{
clearVars();
for (variable_list** p_var = &variables; vars != NULL;
- vars = vars->next_variable, p_var = &(*p_var)->next_variable)
- {
+ vars = vars->next_variable, p_var = &(*p_var)->next_variable) {
*p_var = new Var(static_cast<Var&>(*vars));
}
}
msg.getPod(time);
int count = msg.getInt();
for (variable_list** p_var = &variables; count > 0;
- p_var = &(*p_var)->next_variable, --count)
- {
+ p_var = &(*p_var)->next_variable, --count) {
Var* var = new Var();
var->unpack(msg);
*p_var = var;
return count;
}
-void
+void
Snmp::Pdu::fixAggregate()
{
if (aggrCount < 2)
return;
for (variable_list* p_aggr = variables; p_aggr != NULL; p_aggr = p_aggr->next_variable) {
Var& aggr = static_cast<Var&>(*p_aggr);
- if(snmpAggrType(aggr.name, aggr.name_length) == atAverage) {
+ if (snmpAggrType(aggr.name, aggr.name_length) == atAverage) {
aggr /= aggrCount;
}
}
void clearVars(); ///< clear variables list
Range<const oid*> getSystemOid() const;
void setSystemOid(const Range<const oid*>& systemOid);
- void clearSystemOid();
+ void clearSystemOid();
private:
void init(); ///< initialize members
Snmp::Request::Request(int aRequestorId, unsigned int aRequestId,
const Pdu& aPdu, const Session& aSession,
int aFd, const Ip::Address& anAddress):
- Ipc::Request(aRequestorId, aRequestId),
- pdu(aPdu), session(aSession), fd(aFd), address(anAddress)
+ Ipc::Request(aRequestorId, aRequestId),
+ pdu(aPdu), session(aSession), fd(aFd), address(anAddress)
{
}
Snmp::Request::Request(const Request& request):
- Ipc::Request(request.requestorId, request.requestId),
- pdu(request.pdu), session(request.session),
- fd(request.fd), address(request.address)
+ Ipc::Request(request.requestorId, request.requestId),
+ pdu(request.pdu), session(request.session),
+ fd(request.fd), address(request.address)
{
}
Snmp::Request::Request(const Ipc::TypedMsgHdr& msg):
- Ipc::Request(0, 0)
+ Ipc::Request(0, 0)
{
msg.checkType(Ipc::mtSnmpRequest);
msg.getPod(requestorId);
{
public:
Request(int aRequestorId, unsigned int aRequestId, const Pdu& aPdu,
- const Session& aSession, int aFd, const Ip::Address& anAddress);
+ const Session& aSession, int aFd, const Ip::Address& anAddress);
explicit Request(const Ipc::TypedMsgHdr& msg); ///< from recvmsg()
/* Ipc::Request API */
public:
Pdu pdu; ///< SNMP protocol data unit
- Session session; ///< SNMP session
+ Session session; ///< SNMP session
int fd; ///< client connection descriptor
Ip::Address address; ///< client address
};
}
Snmp::Response::Response(unsigned int aRequestId):
- Ipc::Response(aRequestId), pdu()
+ Ipc::Response(aRequestId), pdu()
{
}
Snmp::Response::Response(const Response& response):
- Ipc::Response(response.requestId), pdu(response.pdu)
+ Ipc::Response(response.requestId), pdu(response.pdu)
{
}
Snmp::Response::Response(const Ipc::TypedMsgHdr& msg):
- Ipc::Response(0)
+ Ipc::Response(0)
{
msg.checkType(Ipc::mtSnmpResponse);
msg.getPod(requestId);
namespace Snmp
{
-///
+///
class Response: public Ipc::Response
{
public:
Snmp::Var&
Snmp::Var::operator += (const Var& var)
{
- switch(type)
- {
+ switch (type) {
case SMI_INTEGER:
setInt(asInt() + var.asInt());
break;
Snmp::Var::operator /= (int num)
{
Must(num != 0);
- switch(type)
- {
+ switch (type) {
case SMI_INTEGER:
setInt(asInt() / num);
break;
bool
Snmp::Var::operator < (const Var& var) const
{
- switch(type)
- {
+ switch (type) {
case SMI_INTEGER:
return asInt() < var.asInt();
case SMI_GAUGE32:
bool
Snmp::Var::operator > (const Var& var) const
{
- switch(type)
- {
+ switch (type) {
case SMI_INTEGER:
return asInt() > var.asInt();
case SMI_GAUGE32:
Var& operator /= (int num);
bool operator < (const Var& var) const;
bool operator > (const Var& var) const;
-
+
void pack(Ipc::TypedMsgHdr& msg) const; ///< prepare for sendmsg()
void unpack(const Ipc::TypedMsgHdr& msg); ///< restore struct from the message
snmpAddNodeStr("1.3.6.1.4.1.3495.1.3.1", PERF_SYS_NUMOBJCNT, snmp_prfSysFn, static_Inst, atSum);
/*
Amos comments:
- The meaning of LRU is "oldest timestamped object in cache, if LRU algorithm is
+ The meaning of LRU is "oldest timestamped object in cache, if LRU algorithm is
used"...
- What this SMP support needs to do is aggregate via a special filter equivalent to
- min() to retain the semantic oldest-object meaning. A special one is needed that
- works as unsigned and ignores '0' values.
+ What this SMP support needs to do is aggregate via a special filter equivalent to
+ min() to retain the semantic oldest-object meaning. A special one is needed that
+ works as unsigned and ignores '0' values.
*/
snmpAddNodeStr("1.3.6.1.4.1.3495.1.3.1", PERF_SYS_CURLRUEXP, snmp_prfSysFn, static_Inst);
snmpAddNodeStr("1.3.6.1.4.1.3495.1.3.1", PERF_SYS_CURUNLREQ, snmp_prfSysFn, static_Inst, atSum);
if (UsingSmp() && IamWorkerProcess()) {
AsyncJob::Start(new Snmp::Forwarder(static_cast<Snmp::Pdu&>(*rq->PDU),
- static_cast<Snmp::Session&>(rq->session), rq->sock, rq->from));
+ static_cast<Snmp::Session&>(rq->session), rq->sock, rq->from));
snmp_free_pdu(rq->PDU);
return;
}