517{
518 if (service.size() > 15 || protocol.size() > 15) {
519 return boost::none;
520 }
521
522 std::vector<char> data;
523 data.reserve(service.size() + 18);
524
525
526 static const unsigned char rq_meta[] = {
527 0x00, 0x00,
528 0x00, 0x00,
529 0x00, 0x01,
530 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
531 };
532 std::copy(rq_meta, rq_meta + sizeof(rq_meta), std::back_inserter(data));
533
534
535 data.push_back(service.size() + 1);
536 data.push_back('_');
537 data.insert(data.end(), service.begin(), service.end());
538 data.push_back(protocol.size() + 1);
539 data.push_back('_');
540 data.insert(data.end(), protocol.begin(), protocol.end());
541
542
543 static const unsigned char ptr_tail[] = {
544 0x05,
545 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00,
546 0x00, 0x0c,
547 0x00, 0xff,
548 };
549 std::copy(ptr_tail, ptr_tail + sizeof(ptr_tail), std::back_inserter(data));
550
552}