This file is indexed.

/usr/include/dballe/msg/codec.h is in libdballe-dev 7.7-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
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
167
#ifndef DBA_MSG_CODEC_H
#define DBA_MSG_CODEC_H

#include <dballe/file.h>
#include <dballe/message.h>
#include <memory>
#include <string>
#include <cstdio>

/** @file
 * @ingroup msg
 * General codec options
 */

namespace wreport {
struct Bulletin;
}

namespace dballe {
struct Messages;
struct Message;

namespace msg {

/**
 * Message importer
 *
 * This class is designed like a configurable virtual functor.
 *
 * Importers of various kinds can provide their implementations.
 */
class Importer
{
public:
    struct Options
    {
        bool simplified;

        /// Create new Options initialised with default values
        Options()
            : simplified(true) {}

        bool operator==(const Options& o) const { return simplified == o.simplified; }
        bool operator!=(const Options& o) const { return simplified != o.simplified; }

        /// Print a summary of the options to \a out
        void print(FILE* out);

        /// Generate a string summary of import options
        std::string to_string() const;

        /// Opposite of to_string: create an Options from a string
        static Options from_string(const std::string& s);
    };

protected:
    Options opts;

public:
    Importer(const Options& opts);
    virtual ~Importer();

    /**
     * Decode a message from its raw encoded representation
     *
     * @param rmsg
     *   Encoded message
     * @retval msgs
     *   The resulting ::dba_msg
     */
    Messages from_binary(const BinaryMessage& msg) const;

    /**
     * Decode a message from its raw encoded representation, calling \a dest on
     * each resulting Message.
     *
     * Return false from \a dest to stop decoding.
     *
     * @param rmsg
     *   Encoded message.
     * @retval dest
     *   The function that consumes the decoded messages.
     * @returns true if it got to the end of decoding, false if dest returned false.
     */
    virtual bool foreach_decoded(const BinaryMessage& msg, std::function<bool(std::unique_ptr<Message>&&)> dest) const = 0;

    /**
     * Import a decoded BUFR/CREX message
     */
    virtual Messages from_bulletin(const wreport::Bulletin& msg) const = 0;


    /// Instantiate the right importer for the given type
    static std::unique_ptr<Importer> create(File::Encoding type, const Options& opts=Options());
};

/**
 * Message exporter
 *
 * This class is designed like a configurable virtual functor.
 *
 * Exporters of various kinds can provide their implementations.
 */
class Exporter
{
public:
    struct Options
    {
        /// Name of template to use for output (leave empty to autodetect)
        std::string template_name;
        /// Originating centre
        int centre;
        /// Originating subcentre
        int subcentre;
        /// Originating application ID
        int application;

        /// Create new Options initialised with default values
        Options()
            : centre(MISSING_INT), subcentre(MISSING_INT), application(MISSING_INT) {}

        /// Print a summary of the options to \a out
        void print(FILE* out);

        /// Generate a string summary of export options
        std::string to_string() const;
    };

protected:
    Options opts;

public:
    Exporter(const Options& opts);
    virtual ~Exporter();

    /**
     * Encode a message
     *
     * @param msgs
     *   Message to encode
     * @retval rmsg
     *   The resulting BinaryMessage
     */
    virtual std::string to_binary(const Messages& msgs) const = 0;

    /**
     * Export to a Bulletin
     */
    virtual std::unique_ptr<wreport::Bulletin> to_bulletin(const Messages& msgs) const = 0;

    /**
     * Create a bulletin that works with this exporter.
     *
     * @returns the bulletin, or NULL of this is an exporter for a format not
     * covered by Bulletin
     */
    virtual std::unique_ptr<wreport::Bulletin> make_bulletin() const;


    /// Instantiate the right importer for the given type
    static std::unique_ptr<Exporter> create(File::Encoding type, const Options& opts=Options());
};

}
}

#endif