summaryrefslogtreecommitdiffstats
path: root/src/include/kernel/blockmsghdlr.H
blob: e67c1911ddccb74d1f9700e2e05a9934fe46101b (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
/** @file blockmsghdlr.H
 *  @brief Defines the implementation for a block's handling of messages.
 */
#ifndef __KERNEL_BLOCKMSGHDLR_H
#define __KERNEL_BLOCKMSGHDLR_H

#include <stdint.h>
#include <kernel/types.h>
#include <kernel/msghandler.H>

//Forward declaration.
class Spinlock;
class MessageQueue;
class Block;

/**
 * @class BlockMsgHdlr
 * @brief Class to handle message data for blocks
 *
 * This class extends from the base MessageHandler so the base send/receive
 * message functions can be utilized. It overrides how to handle the message
 * responses for blocks within the base virtual memory segment.
 */
class BlockMsgHdlr : public MessageHandler
{
    public:

        /**
         * @brief Constructor
         *
         * @param[in] i_lock - Subsystem lock for this message handler, passed
         *                     directly onto the MessageHandler
         * @param[in] i_msgq - Queue used to send messages into userspace,
         *                     passed directly onto the MessageHandler
         * @param[in] i_block - Block to associate this message handler to
         */
        BlockMsgHdlr(Spinlock* i_lock, MessageQueue* i_msgq, Block* i_block) :
                     MessageHandler(i_lock,i_msgq), iv_block(i_block) {};

        /**
         * @brief Destructor
         */
        ~BlockMsgHdlr() {};

        /**
         * @brief Handle response to 'send message' associated with this block
         *
         *  @param[in] i_type - The message type previously sent.
         *  @param[in] i_key - The key value for the received message.
         *  @param[in] i_task - The deferred task.
         *  @param[in] i_rc - The response rc from userspace.
         *
         *  @return HandleResult - The desired behavior on the 'recv message'
         *                         interface for this <key, task> pair.
         */
        virtual HandleResult handleResponse(msg_sys_types_t i_type,void* i_key,
                                            task_t* i_task,int i_rc);

    private:

        /* Associated block for this message handler */
        Block* const iv_block;
};

#endif
OpenPOWER on IntegriCloud