24 using YarpXmlRpc::XmlRpcValue;
25 using YarpXmlRpc::XmlRpcClient;
26 using YarpXmlRpc::XmlRpcServerConnection;
37 vout = std::string(
"[") + std::string(vin.
toString()) +
"]";
46 }
else if (tag==
"dict") {
51 for (
size_t i=0; i<bot->
size(); i++) {
65 for (
size_t i=offset; i<bot->
size(); i++) {
67 XmlRpcValue& vouti=vout[std::string(boti->
get(0).
toString())]=XmlRpcValue();
72 for (
size_t i=offset; i<bot->
size(); i++) {
73 XmlRpcValue& vouti = vout[i] = XmlRpcValue();
100 if (header.length()>0 && header[0]==
'q') {
107 std::string methodName;
113 if (bot->
size()==1) {
122 c.generateRequest(methodName.c_str(),args);
123 req = c.getRequest();
125 XmlRpcServerConnection c(0,
nullptr);
126 c.generateResponse(args.toXml());
127 req = c.getResponse();
131 if (req.length()<8) {
143 Bytes b((
char*)http.c_str(),http.length());
148 Bytes b((
char*)req.c_str()+start,req.length()-start);
157 return write(proto,writer);
170 bool nodelike =
false;
180 if (opt.
check(
"node_like")) {
185 std::string rospass = n.getCarrierModifier(
"ros");
186 interpretRos = !nodelike;
187 if (rospass==
"1"||rospass==
"on") {
190 if (rospass==
"0"||rospass==
"off") {
191 interpretRos =
false;
198 shouldInterpretRosMessages(proto);
199 std::string target =
"POST /RPC2";
208 target +=
" HTTP/1.1\n";
210 Bytes b((
char*)target.c_str(),target.length());
218 shouldInterpretRosMessages(proto);
223 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 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 bool isVocab32() const
Checks if value is a vocabulary identifier.
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)