static int dispatch (const char *cmnd, const char *args) { if (T.skip) return SKIP; if (0==strcmp (cmnd, "operation")) return operation ((char *) args); if (T.skip_test) { if (0==strcmp (cmnd, "expect")) return another_skip(); return 0; } if (0==strcmp (cmnd, "accept")) return accept (args); if (0==strcmp (cmnd, "expect")) return expect (args); if (0==strcmp (cmnd, "roundtrip")) return roundtrip (args); if (0==strcmp (cmnd, "banner")) return banner (args); if (0==strcmp (cmnd, "verbose")) return verbose (args); if (0==strcmp (cmnd, "direction")) return direction (args); if (0==strcmp (cmnd, "tolerance")) return tolerance (args); if (0==strcmp (cmnd, "ignore")) return ignore (args); if (0==strcmp (cmnd, "require_grid")) return require_grid (args); if (0==strcmp (cmnd, "echo")) return echo (args); if (0==strcmp (cmnd, "skip")) return skip (args); if (0==strcmp (cmnd, "use_proj4_init_rules")) return use_proj4_init_rules (args); return 0; }
int main() { roundtrip(); LOG(("aes128: Success.\n")); return 0; }
int rcall(Rcall *tx, Rcall *rx) { static uint8 buf[RCALLMAX]; dprint("tx %R\n", tx); dprinthex(tx->pkt, 8+tx->pkt[3]); if(tx->type == Treset){ rx->type = Rreset; return radioreset(); } if(convR2M(tx, buf, sizeof buf) == 0) return -1; if(roundtrip(buf) < 0) return -1; if(convM2R(buf, sizeof buf, rx) == 0){ werrstr("Invalid Rcall R-message"); return -1; } if(rx->type != tx->type+1 && rx->type != Rerr){ werrstr("bad rx Rcall"); return -1; } dprint("rx %R\n", rx); dprinthex(rx->pkt, 8+rx->pkt[3]); return 0; }
void ext_list::ext::serialise(xml::serializer &serialiser, const std::string& ns) { std::istringstream ser(serialised_value_); xml::parser p(ser, "", xml::parser::receive_default); p.next_expect(xml::parser::event_type::start_element, xml::qname(ns, "wrap")); roundtrip(p, serialiser); p.next_expect(xml::parser::event_type::end_element, xml::qname(ns, "wrap")); }
ext_list::ext::ext(xml::parser &parser, const std::string& ns) { std::ostringstream serialisation_stream; xml::serializer s(serialisation_stream, "", 0); s.start_element(xml::qname(ns, "wrap")); // wrapper for the xmlns declaration s.namespace_decl(ns, ""); extension_ID_ = roundtrip(parser, s); s.end_element(xml::qname(ns, "wrap")); serialised_value_ = serialisation_stream.str(); }
static void BencTestRoundtrip(BencObj *obj) { ScopedMem<char> encoded(obj->Encode()); assert(encoded); size_t len; BencObj *obj2 = BencObj::Decode(encoded, &len); assert(obj2 && len == str::Len(encoded)); ScopedMem<char> roundtrip(obj2->Encode()); assert(str::Eq(encoded, roundtrip)); delete obj2; }
// ------------------------------------------------------------------------ // static ACE_THR_FUNC_RETURN start_client(void* _arg) { Test::Roundtrip_var roundtrip(static_cast<Test::Roundtrip_ptr>(_arg)); // Do a couple of calls on the server. If the sever is trying to // do something stupid like sending an exception to us, then it // won't be able to handle more than 1 request from us. Test::Timestamp time = 10; for (int i = 0; i < num_calls; i++) { roundtrip->test_method(time); ACE_DEBUG ((LM_DEBUG, "Sent call # %d\n", i)); } return 0; }
int main() { boost::asio::streambuf sb(256); #if 0 { std::ostream os(&sb); os.write(raw, sizeof(raw)); } #else sb.sputn(raw, sizeof raw); sb.pubseekpos(0); #endif // let's read it out, unmunged: std::string roundtrip(std::istreambuf_iterator<char>(&sb), {}); assert(std::end(raw) == std::mismatch(std::begin(raw), std::end(raw), std::begin(roundtrip)).first); }
void Display::yield(const unsigned time) const { roundtrip(); usleep(time); }