This file is indexed.

/usr/include/ccnet/processor.h is in libccnet-dev 6.1.5-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
168
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */

#ifndef CCNET_PROCESSOR_H
#define CCNET_PROCESSOR_H

#include <glib.h>
#include <glib-object.h>
#include <stdint.h>
#include <ccnet/status-code.h>

#include <pthread.h>

#ifdef WIN32
#define ccnet_pipe_t intptr_t
#else
#define ccnet_pipe_t int
#endif

struct _CcnetClient;

#define CCNET_TYPE_PROCESSOR                  (ccnet_processor_get_type ())
#define CCNET_PROCESSOR(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), CCNET_TYPE_PROCESSOR, CcnetProcessor))
#define CCNET_IS_PROCESSOR(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CCNET_TYPE_PROCESSOR))
#define CCNET_PROCESSOR_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), CCNET_TYPE_PROCESSOR, CcnetProcessorClass))
#define CCNET_IS_PROCESSOR_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), CCNET_TYPE_PROCESSOR))
#define CCNET_PROCESSOR_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), CCNET_TYPE_PROCESSOR, CcnetProcessorClass))

typedef struct _CcnetProcessor CcnetProcessor;
typedef struct _CcnetProcessorClass CcnetProcessorClass;


struct _CcnetProcessor {
    GObject         parent_instance;

    char                  *peer_id;
    struct _CcnetClient   *session;

    char                  *name;

    /* highest bit = 0, master; highest bit = 1, slave */
    uint32_t               id;
    int                    state;
    int                    failure;

    struct CcnetTimer     *timer;

    int                    num_retry;

    /* Set to 1 when handling update or response */
    gboolean               is_active;

    /* Internal flags for handling processor thread. */
    gboolean               thread_running;
    gboolean               delay_shutdown;
    gboolean               was_success;
};

enum {
    STATE_IN_SHUTDOWN = 1 << 8,
    STATE_RECYCLED,
};

enum {
    PROC_NOTSET,
    PROC_DONE,
    PROC_REMOTE_DEAD,
    PROC_NO_SERVICE,
    PROC_PERM_ERR,
    PROC_BAD_RESP,              /* code[0] =='5' || '4' */
};

#define SLAVE_MASK 0x80000000
#define REQUEST_ID_MASK 0x7fffffff
#define REQUEST_ID(processor_id) ((processor_id) & REQUEST_ID_MASK)
#define UPDATE_ID(processor_id) ((processor_id) & REQUEST_ID_MASK)
#define RESPONSE_ID(processor_id) ((processor_id) & REQUEST_ID_MASK)
#define SLAVE_ID(request_id) ((request_id) | SLAVE_MASK)
#define MASTER_ID(request_id) (request_id)

#define PRINT_ID(processor_id) ((processor_id) & SLAVE_MASK) ?  \
                   - REQUEST_ID(processor_id) : REQUEST_ID(processor_id)
#define IS_SLAVE(processor) ((processor)->id & SLAVE_MASK)
#define GET_PNAME(processor) CCNET_PROCESSOR_GET_CLASS(processor)->name

struct _CcnetProcessorClass {
    GObjectClass   parent_class;

    char          *name;

    /* pure virtual function */
    int       (*start)           (CcnetProcessor *processor, 
                                  int argc, char **argv);
    void      (*handle_update)   (CcnetProcessor *processor,
                                  char *code, char *code_msg,
                                  char *content, int clen);
    void      (*handle_response) (CcnetProcessor *processor, 
                                  char *code, char *code_msg,
                                  char *content, int clen);

    void      (*handle_sigchld)  (CcnetProcessor *processor,
                                  int status);

    void      (*shutdown)        (CcnetProcessor *processor);

    void      (*release_resource) (CcnetProcessor *processor);
};

GType ccnet_processor_get_type ();

int ccnet_processor_start (CcnetProcessor *processor, 
                            int argc, char **argv);

int ccnet_processor_startl 
                 (CcnetProcessor *processor, ...) G_GNUC_NULL_TERMINATED;

void ccnet_processor_done (CcnetProcessor *processor, gboolean success);

void ccnet_processor_handle_update (CcnetProcessor *processor, 
                                    char *code, char *code_msg,
                                    char *content, int clen);

void ccnet_processor_handle_response (CcnetProcessor *processor,
                                      char *code, char *code_msg,
                                      char *content, int clen);

void ccnet_processor_handle_sigchld (CcnetProcessor *processor,
                                     int status);


void ccnet_processor_send_request (CcnetProcessor *processor,
                                   const char *request);

void ccnet_processor_send_request_l (CcnetProcessor *processor, 
                                     ...) G_GNUC_NULL_TERMINATED;

void ccnet_processor_send_update(CcnetProcessor *processor, 
                                 const char *code,
                                 const char *code_msg,
                                 const char *content, int clen);

void ccnet_processor_send_response(CcnetProcessor *processor, 
                                   const char *code,
                                   const char *code_msg,
                                   const char *content, int clen);

/*
  The thread func should return the result back by
     return (void *)result;
  The result will be passed to ProcThreadDoneFunc.
  In the done func, the caller should check whether processor->delay_shutdown
  is TRUE. If it is, you should call processor_done().
 */
typedef void* (*ProcThreadFunc)(void *data);
typedef void (*ProcThreadDoneFunc)(void *result);

struct _CcnetJobManager;

/*
 * @job_mgr: the thread pool to create the worker thread.
 *           If it's NULL, processor->session->job_mgr will be used.
 */
int ccnet_processor_thread_create (CcnetProcessor *processor,
                                   struct _CcnetJobManager *job_mgr,
                                   ProcThreadFunc func,
                                   ProcThreadDoneFunc done_func,
                                   void *data);

#endif