/usr/include/google/protobuf-c/protobuf-c-dispatch.h is in libprotobuf-c0-dev 0.14-1build2.
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 | #ifndef __PROTOBUF_C_DISPATCH_H_
#define __PROTOBUF_C_DISPATCH_H_
typedef struct _ProtobufCDispatch ProtobufCDispatch;
typedef struct _ProtobufCDispatchTimer ProtobufCDispatchTimer;
typedef struct _ProtobufCDispatchIdle ProtobufCDispatchIdle;
#include "protobuf-c.h"
typedef enum
{
PROTOBUF_C_EVENT_READABLE = (1<<0),
PROTOBUF_C_EVENT_WRITABLE = (1<<1)
} ProtobufC_Events;
#ifdef WIN32
typedef SOCKET ProtobufC_FD;
#else
typedef int ProtobufC_FD;
#endif
/* Create or destroy a Dispatch */
ProtobufCDispatch *protobuf_c_dispatch_new (ProtobufCAllocator *allocator);
void protobuf_c_dispatch_free(ProtobufCDispatch *dispatch);
ProtobufCDispatch *protobuf_c_dispatch_default (void);
ProtobufCAllocator *protobuf_c_dispatch_peek_allocator (ProtobufCDispatch *);
typedef void (*ProtobufCDispatchCallback) (ProtobufC_FD fd,
unsigned events,
void *callback_data);
/* Registering file-descriptors to watch. */
void protobuf_c_dispatch_watch_fd (ProtobufCDispatch *dispatch,
ProtobufC_FD fd,
unsigned events,
ProtobufCDispatchCallback callback,
void *callback_data);
void protobuf_c_dispatch_close_fd (ProtobufCDispatch *dispatch,
ProtobufC_FD fd);
void protobuf_c_dispatch_fd_closed(ProtobufCDispatch *dispatch,
ProtobufC_FD fd);
/* Timers */
typedef void (*ProtobufCDispatchTimerFunc) (ProtobufCDispatch *dispatch,
void *func_data);
ProtobufCDispatchTimer *
protobuf_c_dispatch_add_timer(ProtobufCDispatch *dispatch,
unsigned timeout_secs,
unsigned timeout_usecs,
ProtobufCDispatchTimerFunc func,
void *func_data);
ProtobufCDispatchTimer *
protobuf_c_dispatch_add_timer_millis
(ProtobufCDispatch *dispatch,
unsigned milliseconds,
ProtobufCDispatchTimerFunc func,
void *func_data);
void protobuf_c_dispatch_remove_timer (ProtobufCDispatchTimer *);
/* Idle functions */
typedef void (*ProtobufCDispatchIdleFunc) (ProtobufCDispatch *dispatch,
void *func_data);
ProtobufCDispatchIdle *
protobuf_c_dispatch_add_idle (ProtobufCDispatch *dispatch,
ProtobufCDispatchIdleFunc func,
void *func_data);
void protobuf_c_dispatch_remove_idle (ProtobufCDispatchIdle *);
/* --- API for use in standalone application --- */
/* Where you are happy just to run poll(2). */
/* protobuf_c_dispatch_run()
* Run one main-loop iteration, using poll(2) (or some system-level event system);
* 'timeout' is in milliseconds, -1 for no timeout.
*/
void protobuf_c_dispatch_run (ProtobufCDispatch *dispatch);
/* --- API for those who want to embed a dispatch into their own main-loop --- */
typedef struct {
ProtobufC_FD fd;
ProtobufC_Events events;
} ProtobufC_FDNotify;
typedef struct {
ProtobufC_FD fd;
ProtobufC_Events old_events;
ProtobufC_Events events;
} ProtobufC_FDNotifyChange;
void protobuf_c_dispatch_dispatch (ProtobufCDispatch *dispatch,
size_t n_notifies,
ProtobufC_FDNotify *notifies);
void protobuf_c_dispatch_clear_changes (ProtobufCDispatch *);
struct _ProtobufCDispatch
{
/* changes to the events you are interested in. */
/* (this handles closed file-descriptors
in a manner agreeable to epoll(2) and kqueue(2)) */
size_t n_changes;
ProtobufC_FDNotifyChange *changes;
/* the complete set of events you are interested in. */
size_t n_notifies_desired;
ProtobufC_FDNotify *notifies_desired;
/* number of milliseconds to wait if no events occur */
protobuf_c_boolean has_timeout;
unsigned long timeout_secs;
unsigned timeout_usecs;
/* true if there is an idle function, in which case polling with
timeout 0 is appropriate */
protobuf_c_boolean has_idle;
unsigned long last_dispatch_secs;
unsigned last_dispatch_usecs;
/* private data follows (see RealDispatch structure in .c file) */
};
void protobuf_c_dispatch_destroy_default (void);
#endif
|