2011-12-22 16:19:25 +01:00
|
|
|
/*
|
|
|
|
* \brief Native types
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2007-10-15
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2013-01-10 21:44:47 +01:00
|
|
|
* Copyright (C) 2007-2013 Genode Labs GmbH
|
2011-12-22 16:19:25 +01:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
|
|
* under the terms of the GNU General Public License version 2.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _INCLUDE__BASE__NATIVE_TYPES_H_
|
|
|
|
#define _INCLUDE__BASE__NATIVE_TYPES_H_
|
|
|
|
|
2012-11-21 15:20:21 +01:00
|
|
|
#include <util/string.h>
|
2012-03-08 12:45:18 +01:00
|
|
|
#include <base/native_capability.h>
|
2012-08-29 14:42:56 +02:00
|
|
|
#include <base/stdint.h>
|
2012-03-07 11:58:40 +01:00
|
|
|
|
2011-12-22 16:19:25 +01:00
|
|
|
namespace Genode {
|
|
|
|
|
2012-07-18 14:48:37 +02:00
|
|
|
struct Cap_dst_policy
|
|
|
|
{
|
2012-07-18 14:07:13 +02:00
|
|
|
struct Dst
|
|
|
|
{
|
|
|
|
int socket;
|
|
|
|
|
2012-07-18 14:48:37 +02:00
|
|
|
/**
|
|
|
|
* Default constructor creates invalid destination
|
|
|
|
*/
|
2012-08-08 22:01:04 +02:00
|
|
|
Dst() : socket(-1) { }
|
2012-07-18 14:07:13 +02:00
|
|
|
|
2012-08-08 22:01:04 +02:00
|
|
|
explicit Dst(int socket) : socket(socket) { }
|
2012-07-18 14:07:13 +02:00
|
|
|
};
|
|
|
|
|
2012-08-08 22:01:04 +02:00
|
|
|
static bool valid(Dst id) { return id.socket != -1; }
|
2012-07-18 14:07:13 +02:00
|
|
|
static Dst invalid() { return Dst(); }
|
2012-03-09 11:39:46 +01:00
|
|
|
static void copy(void* dst, Native_capability_tpl<Cap_dst_policy>* src);
|
2012-03-08 12:45:18 +01:00
|
|
|
};
|
|
|
|
|
2012-03-09 11:39:46 +01:00
|
|
|
typedef Native_capability_tpl<Cap_dst_policy> Native_capability;
|
2012-07-18 12:34:11 +02:00
|
|
|
|
2012-07-18 14:48:37 +02:00
|
|
|
/**
|
|
|
|
* The connection state is the socket handle of the RPC entrypoint
|
|
|
|
*/
|
2012-08-08 22:01:04 +02:00
|
|
|
struct Native_connection_state
|
|
|
|
{
|
|
|
|
int server_sd;
|
|
|
|
int client_sd;
|
|
|
|
|
|
|
|
Native_connection_state() : server_sd(-1), client_sd(-1) { }
|
|
|
|
};
|
|
|
|
|
|
|
|
enum { PARENT_SOCKET_HANDLE = 100 };
|
2011-12-22 16:19:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _INCLUDE__BASE__NATIVE_TYPES_H_ */
|