// -*- Mode: C++ -*-
// vim:ft=cpp
/**
 * \file
 * \brief   Parent interface
 */
/*
 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
 *               Alexander Warg <warg@os.inf.tu-dresden.de>
 *     economic rights: Technische Universität Dresden (Germany)
 *
 * This file is part of TUD:OS and distributed under the terms of the
 * GNU General Public License 2.
 * Please see the COPYING-GPL-2 file for details.
 *
 * As a special exception, you may use this file as part of a free software
 * library without restriction.  Specifically, if other files instantiate
 * templates or use macros or inline functions from this file, or you compile
 * this file and link it with other files to produce an executable, this
 * file does not by itself cause the resulting executable to be covered by
 * the GNU General Public License.  This exception does not however
 * invalidate any other reasons why the executable file might be covered by
 * the GNU General Public License.
 */
#pragma once

#include <l4/sys/capability>
#include <l4/re/protocols.h>
#include <l4/sys/cxx/ipc_iface>

namespace L4Re {

/**
 * \defgroup api_l4re_parent Parent API
 * \ingroup api_l4re
 * \brief Parent interface.
 *
 * The parent interface provides means for an L4 task to signal changes in
 * its execution state. The main purpose is to signal program termination.
 *
 * \see L4Re::Parent for information about the concrete interface.
 */

/**
 * \brief Parent interface
 * \ingroup api_l4re_parent
 *
 * \see \link api_l4re_parent Parent API \endlink for more details about
 *      the purpose.
 */
class L4_EXPORT Parent :
  public L4::Kobject_t<Parent, L4::Kobject, L4RE_PROTO_PARENT>
{
public:
  /**
   * \brief Send a signal to the parent
   * \param sig Signal to send
   * \param val Value of the signal
   *
   * \return 0 on success, <0 on error
   *         - -#L4_ENOREPLY
   *         - IPC errors
   */
  L4_INLINE_RPC(long, signal, (unsigned long sig, unsigned long val));
  typedef L4::Typeid::Rpcs<signal_t> Rpcs;
};
};

