libupnpp  0.16.0
A C++ wrapper for the Portable UPnP reference library
service.hxx
1 /* Copyright (C) 2006-2016 J.F.Dockes
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16  * 02110-1301 USA
17  */
18 #ifndef _SERVICE_H_X_INCLUDED_
19 #define _SERVICE_H_X_INCLUDED_
20 
21 #include <string>
22 #include <vector>
23 
24 #include "libupnpp/upnppexports.hxx"
25 
26 namespace UPnPProvider {
27 
28 class UpnpDevice;
29 
36 class UPNPP_API UpnpService {
37 public:
56  UpnpService(const std::string& stp,const std::string& sid,
57  const std::string& xmlfn, UpnpDevice *dev, bool noevents=false);
58 
59  virtual ~UpnpService();
60 
74  virtual bool getEventData(bool all, std::vector<std::string>& names,
75  std::vector<std::string>& values);
76 
77  UpnpDevice *getDevice();
78  virtual const std::string& getServiceType() const;
79  virtual const std::string& getServiceId() const;
80  virtual const std::string& getXMLFn() const;
81 
83  bool noevents() const;
84 
91  virtual const std::string errString(int error) const;
92 
93  virtual const std::string serviceErrString(int) const {
94  return "";
95  }
96 
97  // Common (service-type-independant) error codes
98  enum UPnPError {
99  UPNP_INVALID_ACTION = 401,
100  UPNP_INVALID_ARGS = 402,
101  UPNP_INVALID_VAR = 404,
102  // This one mine...
103  UPNP_ACTION_CONFLICT = 409,
104  UPNP_ACTION_FAILED = 501,
105 
106  /* 600-699 common action errors */
107  UPNP_ARG_VALUE_INVALID = 600,
108  UPNP_ARG_VALUE_OUT_OF_RANGE = 601,
109  UPNP_OPTIONAL_ACTION_NOT_IMPLEMENTED = 602,
110  UPNP_OUT_OF_MEMORY = 603,
111  UPNP_HUMAN_INTERVENTION_REQUIRED = 604,
112  UPNP_STRING_ARGUMENT_TOO_LONG = 605,
113  UPNP_ACTION_NOT_AUTHORIZED = 606,
114  UPNP_SIGNATURE_FAILING = 607,
115  UPNP_SIGNATURE_MISSING = 608,
116  UPNP_NOT_ENCRYPTED = 609,
117  UPNP_INVALID_SEQUENCE = 610,
118  UPNP_INVALID_CONTROL_URLS = 611,
119  UPNP_NO_SUCH_SESSION = 612,
120  };
121 
122 
123 private:
124  class UPNPP_LOCAL Internal;
125  Internal *m;
126 };
127 
128 } // End namespace UPnPProvider
129 
130 
131 #endif /* _SERVICE_H_X_INCLUDED_ */
Base Device class.
Definition: device.hxx:54
Upnp service base class.
Definition: service.hxx:36
Virtual directory handler to satisfy libupnp miniserver GETs.
Definition: device.cxx:49