Buffers

차례

Synopsis
Description
Details

Buffers - support for buffer objects

Synopsis

struct  EDNetBuf;

EDNetBuf *ednet_buf_new   (unsigned int len);
EDNetBuf *ednet_buf_ref   (EDNetBuf    *buf);
void      ednet_buf_unref (EDNetBuf    *buf);

Description

Buffer objects are widely used within EDNet SDK internal. It's a base object of EDNetFrame object, so you can call ednet_buf_*() functions with EDNetFrame objects. But It's better to use ednet_frame_*() functions for EDNetFrame objects.

Details

EDNetBuf

typedef struct
{
  const char  *dummy;
  void       (*finalize) (void *object);
  int          _ref;
  unsigned int len;
  char        *data;
} EDNetBuf;

A Buffer used to contain large data chunks. It supports basic reference counting mechanism for efficient memory mananament in multi-thread environment.

const char *dummy :

private data. NEVER MODIFY THIS!

void (*finalize) (void *object) :

private data. NEVER MODIFY THIS!

int _ref :

private data. NEVER MODIFY THIS!

unsigned int len :

the length of buffer data.

char *data :

the pointer to buffer data.

ednet_buf_new ()

EDNetBuf *ednet_buf_new   (unsigned int len);

Creates a new buffer, whose data space will be allocated with specified size.

len :

the length of buffer data

Returns :

a new EDNetBuf, NULL if an error occurred.

ednet_buf_ref ()

EDNetBuf *ednet_buf_ref   (EDNetBuf    *buf);

Adds a reference to the buffer.

buf :

a EDNetBuf

ednet_buf_unref ()

void      ednet_buf_unref (EDNetBuf    *buf);

Removes a reference from the buffer, deallocating the buffer if no references remain.

buf :

a EDNetBuf