non-buffered I/O

      
#include <libetpan/libetpan.h>

struct mailstream_low_driver {
  ssize_t (* mailstream_read)(mailstream_low *, void *, size_t);
  ssize_t (* mailstream_write)(mailstream_low *, void *, size_t);
  int (* mailstream_close)(mailstream_low *);
  int (* mailstream_get_fd)(mailstream_low *);
  void (* mailstream_free)(mailstream_low *);
};

typedef struct mailstream_low_driver mailstream_low_driver;

struct _mailstream_low {
  void * data;
  mailstream_low_driver * driver;
};
        

mailstream_low is a non-buffered stream.

The mailstream_low_driver is a set of functions used to access the stream.

      
mailstream_low * mailstream_low_new(void * data,
    mailstream_low_driver * driver);
      

mailstream_low_new() creates a low-level mailstream with the given internal structure (data) and using the given set of functions (driver).

      
ssize_t mailstream_low_write(mailstream_low * s, void * buf, size_t count);

ssize_t mailstream_low_read(mailstream_low * s, void * buf, size_t count);

int mailstream_low_close(mailstream_low * s);

int mailstream_low_get_fd(mailstream_low * s);

void mailstream_low_free(mailstream_low * s);
      

Each of these calls will call the corresponding function defined in the driver.