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-2010 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/capability.h>
  22  
  23  namespace Genode {
  24  
  25     class Cap_session
  26     {
  27        protected:
  28  
  29           enum Opcode { ALLOC, FREE };

  30  
  31        public:
  32  
  33           static const char *service_name() { return "CAP"; }
  34  
  35           virtual ~Cap_session() { }
  36  
  37           /**
  38            * Allocate new unique userland capability
  39            *
  40            * \param ep  entry point that will use this capability
  41            *
  42            * \return new userland capability
  43            */

  44           virtual Capability alloc(Capability ep) = 0;

  45  
  46           /**
  47            * Free userland capability
  48            *
  49            * \param cap  userland capability to free
  50            */

  51           virtual void free(Capability cap) = 0;

  52     }
;

  53  }

  54  
  55  #endif /* _INCLUDE__CAP_SESSION__CAP_SESSION_H_ */