495{
496 if (service.size() > 15 || protocol.size() > 15) {
497 return boost::none;
498 }
499
500 std::vector<char>
data;
501 data.reserve(service.size() + 18);
502
503
504 static const unsigned char rq_meta[] = {
505 0x00, 0x00,
506 0x00, 0x00,
507 0x00, 0x01,
508 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
509 };
510 std::copy(rq_meta, rq_meta + sizeof(rq_meta), std::back_inserter(data));
511
512
513 data.push_back(service.size() + 1);
515 data.insert(
data.end(), service.begin(), service.end());
516 data.push_back(protocol.size() + 1);
518 data.insert(
data.end(), protocol.begin(), protocol.end());
519
520
521 static const unsigned char ptr_tail[] = {
522 0x05,
523 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x00,
524 0x00, 0x0c,
525 0x00, 0xff,
526 };
527 std::copy(ptr_tail, ptr_tail + sizeof(ptr_tail), std::back_inserter(data));
528
530}