1  /*
   2   * \brief  CAP-session interface
   3   * \author Norman Feske
   4   * \date   2006-06-23
   5   *
   6   * A `Cap_session` is an allocator of user-level capabilities.
   7   * User-level capabilities are used to reference server objects
   8   * across address spaces.
   9   */

  10  
  11  /*
  12   * Copyright (C) 2006-2013 Genode Labs GmbH
  13   *
  14   * This file is part of the Genode OS framework, which is distributed
  15   * under the terms of the GNU General Public License version 2.
  16   */

  17  
  18  #ifndef _INCLUDE__CAP_SESSION__CAP_SESSION_H_
  19  #define _INCLUDE__CAP_SESSION__CAP_SESSION_H_
  20  
  21  #include <base/native_types.h>
  22  #include <session/session.h>
  23  
  24  namespace Genode {
  25  
  26     struct Cap_session : Session
  27     {
  28        static const char *service_name() { return "CAP"; }
  29  
  30        virtual ~Cap_session() { }
  31  
  32        /**
  33         * Allocate new unique userland capability
  34         *
  35         * \param ep  entry point that will use this capability
  36         *
  37         * \return new userland capability
  38         */

  39        virtual Native_capability alloc(Native_capability ep) = 0;

  40  
  41        /**
  42         * Free userland capability
  43         *
  44         * \param cap  userland capability to free
  45         */

  46        virtual void free(Native_capability cap) = 0;

  47  
  48  
  49        /*********************
  50         ** RPC declaration **
  51         *********************/

  52  
  53        GENODE_RPC(Rpc_alloc, Native_capability, alloc, Native_capability);
  54        GENODE_RPC(Rpc_free, void, free, Native_capability);
  55        GENODE_RPC_INTERFACE(Rpc_alloc, Rpc_free);
  56     }
;

  57  }

  58  
  59  #endif /* _INCLUDE__CAP_SESSION__CAP_SESSION_H_ */