This file is indexed.

/usr/include/hidrd/item/long.h is in libhidrd0-dev 0.2.0-11.

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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/** @file
 * @brief HID report descriptor - long item
 *
 * Copyright (C) 2009 Nikolai Kondrashov
 *
 * This file is part of hidrd.
 *
 * Hidrd is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Hidrd 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with hidrd; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * @author Nikolai Kondrashov <spbnick@gmail.com>
 *
 * @(#) $Id: long.h 370 2010-04-28 09:24:33Z spb_nick $
 */

#ifndef __HIDRD_ITEM_LONG_H__
#define __HIDRD_ITEM_LONG_H__

#include <assert.h>
#include "hidrd/item/basic.h"

#ifdef __cplusplus
extern "C" {
#endif


#define HIDRD_ITEM_LONG_MIN_SIZE    3
#define HIDRD_ITEM_LONG_DATA_SIZE_MAX   UINT8_MAX
#define HIDRD_ITEM_LONG_MAX_SIZE    (HIDRD_ITEM_LONG_MIN_SIZE + \
                                     HIDRD_ITEM_LONG_DATA_SIZE_MAX)


static inline bool
hidrd_item_long_valid_class(const hidrd_item *item)
{
    return hidrd_item_basic_valid_class(item) &&
           hidrd_item_basic_is_long(item);
}


static inline bool
hidrd_item_long_valid_inst(const hidrd_item *item)
{
    assert(hidrd_item_long_valid_class(item));
    return hidrd_item_basic_valid_inst(item);
}


static inline bool
hidrd_item_long_valid(const hidrd_item *item)
{
    return hidrd_item_long_valid_class(item) &&
           hidrd_item_long_valid_inst(item);
}


static inline hidrd_item *
hidrd_item_long_validate(hidrd_item *item)
{
    assert(hidrd_item_long_valid(item));
    return (hidrd_item *)item;
}


typedef uint8_t hidrd_item_long_tag;

static inline bool
hidrd_item_long_tag_valid(hidrd_item_long_tag tag)
{
    (void)tag;
    return true;
}

/** Data size */
typedef uint8_t hidrd_item_long_data_size;

static inline bool
hidrd_item_long_data_size_valid(hidrd_item_long_data_size size)
{
    (void)size;
    return true;
}

static inline hidrd_item_long_data_size
hidrd_item_long_get_data_size(const hidrd_item *item)
{
    assert(hidrd_item_long_valid(item));
    /* We promise not to change the item */
    return ((uint8_t *)hidrd_item_basic_get_data((hidrd_item *)item))[0];
}

static inline hidrd_item *
hidrd_item_long_set_data_size(hidrd_item                   *item,
                              hidrd_item_long_data_size     size)
{
    assert(hidrd_item_long_valid(item));
    assert(hidrd_item_long_data_size_valid(size));
    ((uint8_t *)hidrd_item_basic_get_data(item))[0] = size;
    return item;
}

static inline hidrd_item_long_tag
hidrd_item_long_get_tag(const hidrd_item *item)
{
    assert(hidrd_item_long_valid(item));
    /* We promise not to change the item */
    return ((uint8_t *)hidrd_item_basic_get_data((hidrd_item *)item))[1];
}

static inline hidrd_item *
hidrd_item_long_set_tag(hidrd_item *item, hidrd_item_long_tag tag)
{
    assert(hidrd_item_long_valid(item));
    ((uint8_t *)hidrd_item_basic_get_data(item))[1] = tag;
    return item;
}

/* Declare tag numeric string conversion functions */
HIDRD_NUM_CONV_DECLS(item_long_tag);

static inline void *
hidrd_item_long_get_data(hidrd_item *item)
{
    assert(hidrd_item_long_valid(item));
    return &((uint8_t *)hidrd_item_basic_get_data(item))[2];
}

static inline size_t
hidrd_item_long_get_size(const hidrd_item *item)
{
    assert(hidrd_item_long_valid(item));
    return HIDRD_ITEM_LONG_MIN_SIZE + hidrd_item_long_get_data_size(item);
}

static inline hidrd_item *
hidrd_item_long_init(hidrd_item            *item,
                     hidrd_item_long_tag    tag)
{
    return hidrd_item_long_validate(
            hidrd_item_long_set_tag(
                hidrd_item_long_set_data_size(
                    hidrd_item_basic_init(item,
                                          HIDRD_ITEM_BASIC_TYPE_LONG,
                                          HIDRD_ITEM_BASIC_TAG_LONG,
                                          HIDRD_ITEM_BASIC_DATA_SIZE_LONG),
                    0),
                tag));
}


#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* __HIDRD_ITEM_LONG_H__ */