This file is indexed.

/usr/include/ola/rdm/ResponderOps.h is in libola-dev 0.9.8-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
114
115
116
117
118
119
120
121
122
123
/*
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 *
 * ResponderOps.h
 * A framework for building RDM responders.
 * Copyright (C) 2013 Simon Newton
 */

/**
 * @addtogroup rdm_resp
 * @{
 * @file ResponderOps.h
 * @brief A framework for building RDM responders.
 * @}
 */

#ifndef INCLUDE_OLA_RDM_RESPONDEROPS_H_
#define INCLUDE_OLA_RDM_RESPONDEROPS_H_

#include <ola/rdm/RDMCommand.h>
#include <ola/rdm/RDMControllerInterface.h>
#include <ola/rdm/RDMResponseCodes.h>

#include <map>

namespace ola {
namespace rdm {

/**
 * @brief A class which dispatches RDM requests to registered PID handlers.
 *
 * ResponderOps is a stateless RDM request dispatcher. The constructor takes a
 * list of parameter handlers in the form of pointers to member functions. When
 * HandleRDMRequest is called, it invokes the registered handler after
 * performing a common set of checks. If no handler is found, a response
 * containing NR_UNKNOWN_PID is returned.
 *
 * The stateless nature of ResponderOps means a single ResponderOps
 * object can handle requests for all responders of the same type. This
 * conserves memory when large numbers of responders are active.
 *
 * ResponderOps handles SUPPORTED_PARAMETERS internally, however this can be
 * overridden by registering a handler for SUPPORTED_PARAMETERS.
 *
 * @tparam Target the object to invoke the PID handlers on.
 */
template <class Target>
class ResponderOps {
 public:
    /**
     * @brief The member function to call on the target to handle a request.
     *
     * The member function should return a RDMResponse object. If the request
     * was broadcast, this object will be discarded.
     */
    typedef RDMResponse *(Target::*RDMHandler)(const RDMRequest *request);

    /**
     * @brief the structure that defines the behaviour for a specific PID.o
     *
     * Either the get_handler or set_handlers may be NULL if the command
     * class isn't defined for this PID.
     */
    struct ParamHandler {
      uint16_t pid;  /**< The PID this handler is for */
      RDMHandler get_handler;  /**< The method used to handle GETs */
      RDMHandler set_handler;  /**< The method used to handle SETs */
    };

    /**
     * @brief Construct a new ResponderOps object.
     * @param param_handlers an array of ParamHandlers. Must be terminated with
     * {0, NULL, NULL}
     * @param include_required_pids if true, the internal SUPPORTED_PARAMETERS
     *   handler includes those PIDs that are marked a required in E1.20. This
     *   is required for sub-devices, see Section 2 of E1.37.
     */
    explicit ResponderOps(const ParamHandler param_handlers[],
                          bool include_required_pids = false);

    /**
     * @brief Handle a RDMRequest
     * @param target the target object to invoke the registered handler on
     * @param target_uid the UID of the target
     * @param sub_device the sub_device of the target
     * @param request the RDM request object
     * @param on_complete the callback to run when the request completes.
     */
    void HandleRDMRequest(Target *target,
                          const UID &target_uid,
                          uint16_t sub_device,
                          const RDMRequest *request,
                          RDMCallback *on_complete);

 private:
    struct InternalParamHandler {
      RDMHandler get_handler;
      RDMHandler set_handler;
    };
    typedef std::map<uint16_t, InternalParamHandler> RDMHandlers;

    bool m_include_required_pids;
    RDMHandlers m_handlers;

    RDMResponse *HandleSupportedParams(const RDMRequest *request);
};

}  // namespace rdm
}  // namespace ola
#include <ola/rdm/ResponderOpsPrivate.h>  // NOLINT(build/include_order)
#endif  // INCLUDE_OLA_RDM_RESPONDEROPS_H_