| 38 | namespace oid::platform { |
| 39 | |
| 40 | Endpoint parse_endpoint(int argc, char** argv) { |
| 41 | Endpoint ep; |
| 42 | int i = 1; |
| 43 | while (i + 1 < argc) { |
| 44 | const std::string arg = argv[i]; |
| 45 | if (arg == "-h" || arg == "--hostname") { |
| 46 | ep.host = argv[i + 1]; |
| 47 | i += 2; |
| 48 | } else if (arg == "-p" || arg == "--port") { |
| 49 | ep.port = static_cast<unsigned short>(std::stoi(argv[i + 1])); |
| 50 | i += 2; |
| 51 | } else { |
| 52 | ++i; |
| 53 | } |
| 54 | } |
| 55 | return ep; |
| 56 | } |
| 57 | |
| 58 | // No-op on native: there is no inbound host message hook to wire here -- |
| 59 | // that only exists for the non-native (postMessage) embedding, which must |