2d229a2b72
Ping via specific UDP port instead of ICMP Echo with the two new configuration attributes 'protocol' and 'dst_port'. Issue #2775
33 lines
697 B
C++
33 lines
697 B
C++
/*
|
|
* \brief Supported protocols
|
|
* \author Martin Stein
|
|
* \date 2018-03-27
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2018 Genode Labs GmbH
|
|
*
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
* under the terms of the GNU Affero General Public License version 3.
|
|
*/
|
|
|
|
#ifndef __PROTOCOL_H_
|
|
#define __PROTOCOL_H_
|
|
|
|
/* Genode includes */
|
|
#include <base/stdint.h>
|
|
|
|
namespace Genode { enum class Protocol : uint16_t { ICMP, UDP }; }
|
|
|
|
namespace Genode
|
|
{
|
|
inline size_t ascii_to(char const *s, Protocol &result)
|
|
{
|
|
if (!strcmp(s, "icmp", 4)) { result = Protocol::ICMP; return 4; }
|
|
if (!strcmp(s, "udp", 3)) { result = Protocol::UDP; return 3; }
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
#endif /* __PROTOCOL_H_ */
|