summaryrefslogtreecommitdiffstats
path: root/src/include/usr/mbox/mboxif.H
blob: a8609a31f43ae41b3c4ece61ffabba6b0302fa99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/include/usr/mbox/mboxif.H $                               */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2012,2013              */
/*                                                                        */
/* p1                                                                     */
/*                                                                        */
/* Object Code Only (OCO) source materials                                */
/* Licensed Internal Code Source Materials                                */
/* IBM HostBoot Licensed Internal Code                                    */
/*                                                                        */
/* The source code for this program is not published or otherwise         */
/* divested of its trade secrets, irrespective of what has been           */
/* deposited with the U.S. Copyright Office.                              */
/*                                                                        */
/* Origin: 30                                                             */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
#ifndef __MBOX_MBOXIF_H
#define __MBOX_MBOXIF_H

#include <sys/msg.h>
#include <errl/errlentry.H>
#include <mbox/mbox_queues.H>

namespace MBOX
{
    enum
    {
        MBOX_NODE_FSP = -1,
    };

    /**
     * Register a message queue to receive mailbox messages
     * @param[in] i_queueu_id, The queue identifier
     * @param[in] i_msgQ, The message queue created with msg_q_create()
     *                    @see sys/msg.h
     * @return errlHndl_t on error
     */
    errlHndl_t msgq_register(queue_id_t i_queue_id, msg_q_t i_msgQ);

    /**
     * Un register a message queue from the mailbox service
     * @param[in] i_queue_id, The queue identifier
     * @return The message queue | NULL if i_queue_id not registered.
     */
    msg_q_t msgq_unregister(queue_id_t i_queue_id);

    /**
     * Send message asynchronously
     * @param[in] i_q_id id, of the FSP message queue to send the msg to.
     * @param[in] i_msg. The message to send.
     * @param[in] i_node The destination node [0-7] for IPC messages, 
     *                   otherwise the default is FSP
     *
     * @return errlHndl_t on error.
     *
     * @note extra_data payload is not supported for interprocessor
     *       communication(IPC) messages therefore the i_msg->extra_data field
     *       may be used as another user data field
     *
     * @pre For FSP mbox messages, i_msg->extra_data must be NULL If there is
     *      no payload associated with the message.
     *
     * @pre For FSP mbox messages, 
     *      i_msg->extra_data = malloc(size); i_msg->data[1] = size; 
     *      Any extra data associated with i_msg was obtained from the heap
     *      using malloc and i_msg->data[1] contains the length of that data.
     *
     * @post free(i_msg->extra_dat)  was done (if no error)
     * @post msg_free(i_msg) was done (if no error)
     */
    errlHndl_t send(queue_id_t i_q_id,
                    msg_t * i_msg,
                    int i_node = MBOX_NODE_FSP);

    /**
     * Send message synchronously
     * @param[in] i_q_id id, of the FSP message queue to send the msg to.
     * @param[in/out] io_msg. The message sent and returned.
     *
     * @return errlHndl_t on error
     *
     * @pre io_msg->extra_data ==  NULL If there is no extra data is associated
     *      with the message.
     *
     * @pre io_msg->extra_data = malloc(size); io_msg->data[1] = size; 
     *      Any extra data associated with io_msg was obtained from the heap
     *      using malloc and io_msg->data[1] contains the length of that data.
     *
     * @post free(i_msg->extra_data)  was done (if no error)
     *
     * @note: On return, if io_msg->extra_data != NULL, the caller must
     * call free(io_msg->extra_data);
     */
    errlHndl_t sendrecv(queue_id_t i_q_id, msg_t * io_msg);

    /**
     * Determine if the mailbox is enabled
     *
     * @return bool
     *             true    -> mailbox is enabled
     *             flalse  -> mailbox is disabled (spless system)
     */
    bool mailbox_enabled();

}; // end namespace MBOX

#endif
OpenPOWER on IntegriCloud