AgentX++  2.0.5
agentx_request.h
Go to the documentation of this file.
1 /*_############################################################################
2  _##
3  _## agentx_request.h
4  _##
5  _##
6  _## AgentX++ 2
7  _## -------------------------------------
8  _## Copyright (C) 2000-2013 - Frank Fock
9  _##
10  _## Use of this software is subject to the license agreement you received
11  _## with this software and which can be downloaded from
12  _## http://www.agentpp.com
13  _##
14  _## This is licensed software and may not be used in a commercial
15  _## environment, except for evaluation purposes, unless a valid
16  _## license has been purchased.
17  _##
18  _##########################################################################*/
19 
20 #ifndef _agentx_request_h_
21 #define _agentx_request_h_
22 
23 #include <agentx_pp/agentx.h>
24 #include <agent_pp/request.h>
25 #include <agent_pp/vacm.h>
26 
27 #ifdef AGENTPP_NAMESPACE
28 namespace Agentpp {
29 #endif
30 
31 class NoVacm: public Vacm {
32  public:
33  NoVacm();
34  virtual ~NoVacm();
49  virtual int isAccessAllowed(const int securityModel,
50  const NS_SNMP OctetStr &securityName,
51  const int securityLevel, const int viewType,
52  const NS_SNMP OctetStr &context, const Oidx &o)
53  { return VACM_accessAllowed; }
54 
65  virtual int isAccessAllowed(const NS_SNMP OctetStr &viewName, const Oidx &o)
66  { return VACM_accessAllowed; }
67 
80  virtual int getViewName(const int securityModel, const NS_SNMP OctetStr &securityName,
81  const int securityLevel, const int viewType,
82  const NS_SNMP OctetStr &context, NS_SNMP OctetStr &viewName)
83  { return VACM_viewFound; }
84 };
85 
96 class AGENTXPP_DECL AgentXRequest: public Request {
97 friend class AgentXRequestList;
98 friend class SubAgentXMib;
99 public:
100 
107  AgentXRequest(const AgentXPdu&);
108 
112  virtual ~AgentXRequest();
113 
122  virtual Oidx get_oid(int);
123 
124  virtual void set_oid(const Oidx&, int);
125 
132  virtual unsigned short get_agentx_type()
133  { return ((AgentXPdu*)pdu)->get_agentx_type(); }
134 
141  AgentXPdu* get_agentx_pdu() { return (AgentXPdu*)pdu; }
142 
149  virtual bool add_rep_row();
150 
158  virtual void trim_request(int);
159 
164  void lock();
165 
169  void unlock();
170 
171  private:
172  Synchronized mutex;
173 };
174 
175 
176 /*---------------------- class AgentXRequestList ------------------------*/
177 
185 class AGENTXPP_DECL AgentXRequestList: public RequestList {
186 
187 public:
192 
202 
206  virtual ~AgentXRequestList();
207 
218  virtual Request* receive(int);
219 
225  virtual void answer(Request*);
226 
233  void remove(Request*);
234 
241  AgentXSlave* get_agentx() { return agentx; }
242 
255  void timeout_set_requests();
256 
262  void terminate_set_requests();
263 
264 protected:
265 
272  virtual Request* add_request(Request*);
273 
274  // External reference to the AgentX protocol services.
275  // Do not delete in Destructor!
277 };
278 
279 #ifdef AGENTPP_NAMESPACE
280 }
281 #endif
282 
283 
284 #endif