27 using YarpXmlRpc::XmlRpcValue;
28 using YarpXmlRpc::XmlRpcClient;
29 using YarpXmlRpc::XmlRpcServerConnection;
40 vout = std::string(
"[") + std::string(vin.
toString()) +
"]";
49 }
else if (tag==
"dict") {
54 for (
size_t i=0; i<bot->
size(); i++) {
68 for (
size_t i=offset; i<bot->
size(); i++) {
70 XmlRpcValue& vouti=vout[std::string(boti->
get(0).
toString())]=XmlRpcValue();
75 for (
size_t i=offset; i<bot->
size(); i++) {
76 XmlRpcValue& vouti = vout[i] = XmlRpcValue();
103 if (header.length()>0 && header[0]==
'q') {
110 std::string methodName;
116 if (bot->
size()==1) {
125 c.generateRequest(methodName.c_str(),args);
126 req = c.getRequest();
128 XmlRpcServerConnection c(0,
nullptr);
129 c.generateResponse(args.toXml());
130 req = c.getResponse();
134 if (req.length()<8) {
146 Bytes b((
char*)http.c_str(),http.length());
151 Bytes b((
char*)req.c_str()+start,req.length()-start);
160 return write(proto,writer);
173 bool nodelike =
false;
183 if (opt.
check(
"node_like")) {
188 std::string rospass = n.getCarrierModifier(
"ros");
189 interpretRos = !nodelike;
190 if (rospass==
"1"||rospass==
"on") {
193 if (rospass==
"0"||rospass==
"off") {
194 interpretRos =
false;
201 shouldInterpretRosMessages(proto);
202 std::string target =
"POST /RPC2";
211 target +=
" HTTP/1.1\n";
213 Bytes b((
char*)target.c_str(),target.length());
221 shouldInterpretRosMessages(proto);
226 if (stream ==
nullptr) {
void toXmlRpcValue(Value &vin, XmlRpcValue &vout)
const yarp::os::LogComponent & XMLRPCCARRIER()
bool expectSenderSpecifier(yarp::os::ConnectionState &proto) override
Expect the name of the sending port.
bool reply(yarp::os::ConnectionState &proto, yarp::os::SizedWriter &writer) override
bool respondToHeader(yarp::os::ConnectionState &proto) override
Respond to the header.
bool write(yarp::os::ConnectionState &proto, yarp::os::SizedWriter &writer) override
Write a message.
bool sendHeader(yarp::os::ConnectionState &proto) override
Write a header appropriate to the carrier to the connection, followed by any carrier-specific data.
A simple collection of objects that can be described and transmitted in a portable way.
void fromString(const std::string &text)
Initializes bottle from a string.
size_type size() const
Gets the number of elements in the bottle.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
Bottle tail() const
Get all but the first element of a bottle.
A simple abstraction for a block of bytes.
The basic state of a connection - route, streams in use, etc.
virtual Contactable * getContactable() const =0
Get the port associated with the connection.
virtual TwoWayStream & getStreams()=0
Access the streams associated with the connection.
virtual const Route & getRoute() const =0
Get the route associated with this connection.
virtual TwoWayStream * giveStreams()=0
Take ownership of the streams associated with the connection.
virtual void takeStreams(TwoWayStream *streams)=0
Provide streams to be used with the connection.
OutputStream & os()
Shorthand for getOutputStream()
virtual void setRoute(const Route &route)=0
Set the route associated with this connection.
Simple abstraction for a YARP port name.
std::string getCarrierModifier(const char *mod, bool *hasModifier=nullptr)
static Contact queryName(const std::string &name)
Find out information about a registered name.
virtual bool isOk() const =0
Check if the stream is ok or in an error state.
virtual void write(char ch)
Write a single byte to the stream.
A class for storing options and configuration information.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
Information about a connection between two ports.
const std::string & getToName() const
Get the destination of the route.
const std::string & getCarrierName() const
Get the carrier type of the route.
void setFromName(const std::string &fromName)
Set the source of the route.
Minimal requirements for an efficient Writer.
virtual void write(OutputStream &os)
An OutputStream that produces a string.
std::string toString() const
virtual const Contact & getRemoteAddress() const =0
Get the address of the remote side of the stream.
A single value (typically within a Bottle).
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
virtual bool isString() const
Checks if value is a string.
virtual bool isVocab() const
Checks if value is a vocabulary identifier.
virtual std::int32_t asInt32() const
Get 32-bit integer value.
virtual bool isList() const
Checks if value is a list.
virtual Bottle * asList() const
Get list value.
virtual bool isFloat64() const
Checks if value is a 64-bit floating point number.
std::string toString() const override
Return a standard text representation of the content of the object.
virtual bool isInt32() const
Checks if value is a 32-bit integer.
virtual std::string asString() const
Get string value.
#define yCError(component,...)
An interface to the operating system, including Port based communication.
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)