1  /*
   2   * \brief  ROM session interface
   3   * \author Norman Feske
   4   * \date   2006-07-06
   5   *
   6   * A ROM session corresponds to an open file. The file name is specified as an
   7   * argument on session creation.
   8   */

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

  16  
  17  #ifndef _INCLUDE__ROM_SESSION__ROM_SESSION_H_
  18  #define _INCLUDE__ROM_SESSION__ROM_SESSION_H_
  19  
  20  #include <dataspace/capability.h>
  21  #include <session/session.h>
  22  #include <base/signal.h>
  23  
  24  namespace Genode {
  25  
  26     struct Rom_dataspace : Dataspace { };
  27  
  28     typedef Capability<Rom_dataspace> Rom_dataspace_capability;
  29  
  30     struct Rom_session : Session
  31     {
  32        static const char *service_name() { return "ROM"; }
  33  
  34        virtual ~Rom_session() { }
  35  
  36        /**
  37         * Request dataspace containing the ROM session data
  38         *
  39         * \return  capability to ROM dataspace
  40         *
  41         * The capability may be invalid.
  42         *
  43         * Consecutive calls of this functions are not guaranteed to return the
  44         * same dataspace as dynamic ROM sessions may update the ROM data
  45         * during the lifetime of the session. When calling the function, the
  46         * server may destroy the old dataspace and replace it with a new one
  47         * containing the updated data. Hence, prior calling this function, the
  48         * client should make sure to detach the previously requested dataspace
  49         * from its local address space.
  50         */

  51        virtual Rom_dataspace_capability dataspace() = 0;

  52  
  53        /**
  54         * Register signal handler to be notified of ROM data changes
  55         *
  56         * The ROM session interface allows for the implementation of ROM
  57         * services that dynamically update the data exported as ROM dataspace
  58         * during the lifetime of the session. This is useful in scenarios
  59         * where this data is generated rather than originating from a static
  60         * file, for example to update a program`s configuration at runtime.
  61         *
  62         * By installing a signal handler using the `sigh()` function, the
  63         * client will receive a notification each time the data changes at the
  64         * server. From the client`s perspective, the original data contained
  65         * in the currently used dataspace remains unchanged until the client
  66         * calls `dataspace()` the next time.
  67         */

  68        virtual void sigh(Signal_context_capability sigh) = 0;

  69  
  70  
  71        /*********************
  72         ** RPC declaration **
  73         *********************/

  74  
  75        GENODE_RPC(Rpc_dataspace, Rom_dataspace_capability, dataspace);
  76        GENODE_RPC(Rpc_sigh, void, sigh, Signal_context_capability);
  77  
  78        GENODE_RPC_INTERFACE(Rpc_dataspace, Rpc_sigh);
  79     }
;

  80  }

  81  
  82  #endif /* _INCLUDE__ROM_SESSION__ROM_SESSION_H_ */