00001 #ifndef fooshbufhfoo
00002 #define fooshbufhfoo
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <sys/types.h>
00024
00207 struct _shbuf;
00208
00210 typedef struct _shbuf shbuf;
00211
00235 typedef struct {
00236 unsigned long read_idx;
00237 unsigned long length;
00238 unsigned long backlog;
00239 unsigned long backlog_target;
00241 unsigned long write_count;
00242 unsigned long read_count;
00243 int ignore_read_inc;
00247 int ignore_write_inc;
00248 } shbuf_status;
00249
00259 shbuf* shbuf_create(key_t key, unsigned long size);
00260
00271 shbuf* shbuf_open(key_t key);
00272
00279 void shbuf_free(shbuf* sb);
00280
00289 int shbuf_access(shbuf* sb, int mode);
00290
00297 key_t shbuf_get_key(shbuf* sb);
00298
00305 unsigned long shbuf_get_size(shbuf* sb);
00306
00314 unsigned char* shbuf_get_pointer(shbuf* sb);
00315
00323 shbuf_status* shbuf_get_status(shbuf* sb);
00324
00335 int shbuf_notify_enable(shbuf* sb, int b);
00336
00345 int shbuf_notify(shbuf* sb);
00346
00355 int shbuf_wait(shbuf* sb);
00356
00364 int shbuf_get_select_fd(shbuf* sb);
00365
00375 int shbuf_post_select(shbuf *sb);
00376
00386 int shbuf_status_lock(shbuf* sb);
00387
00396 int shbuf_status_unlock(shbuf* sb);
00397
00405 int shbuf_reset(shbuf* sb);
00406
00414 int shbuf_zero(shbuf* sb);
00415
00423 int shbuf_set_backlog_target(shbuf *sb, unsigned long bl);
00424
00433 unsigned long shbuf_get_backlog_target(shbuf *sb);
00434
00446 const unsigned char* shbuf_get_read_pointer(shbuf *sb, unsigned long *l);
00447
00456 int shbuf_inc_read_pointer(shbuf *sb, unsigned long r);
00457
00469 unsigned char* shbuf_get_write_pointer(shbuf *sb, unsigned long *l);
00470
00479 int shbuf_inc_write_pointer(shbuf *sb, unsigned long r);
00480
00488 int shbuf_connected(shbuf *sb);
00489
00496 int shbuf_is_full(shbuf *sb);
00497
00504 int shbuf_is_empty(shbuf *sb);
00505
00521 unsigned long shbuf_rewind(shbuf *sb, unsigned long v);
00522
00540 signed long shbuf_read(shbuf *sb, unsigned char*c, signed long l);
00541
00559 signed long shbuf_write(shbuf *sb, const unsigned char*c, signed long l);
00560
00563 #endif