summaryrefslogtreecommitdiff
path: root/libproto/include/stream0.h
blob: 37bba6708342d5a64452980be591c390df854ba5 (plain)
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
/* GNU Mailutils -- a suite of utilities for electronic mail
   Copyright (C) 1999, 2000, 2001, 2005  Free Software Foundation, Inc.

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General
   Public License along with this library; if not, write to the
   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301 USA */

#ifndef _STREAM0_H
#define _STREAM0_H

#include <mailutils/stream.h>
#ifdef DMALLOC
#include <dmalloc.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif

/* Read buffer */
struct rbuffer
{
  char *base;
  char *ptr;
  size_t count;
  size_t bufsiz;
  mu_off_t offset;
};

struct _mu_stream
{
  void *owner;
  mu_property_t property;

  int flags;
  int state;

  /* Read space */
  struct rbuffer rbuffer;
  
  /* Stream pointer for sequential offset.  */
  mu_off_t offset;
  
  void (*_destroy) (mu_stream_t);
  int (*_open)     (mu_stream_t);
  int (*_close)    (mu_stream_t);
  int (*_get_transport2) (mu_stream_t, mu_transport_t *, mu_transport_t *);
  int (*_read)     (mu_stream_t, char *, size_t, mu_off_t, size_t *);
  int (*_readline) (mu_stream_t, char *, size_t, mu_off_t, size_t *);
  int (*_write)    (mu_stream_t, const char *, size_t, mu_off_t, size_t *);
  int (*_truncate) (mu_stream_t, mu_off_t);
  int (*_size)     (mu_stream_t, mu_off_t *);
  int (*_flush)    (mu_stream_t);
  int (*_setbufsiz)(mu_stream_t, size_t);
  int (*_strerror) (mu_stream_t, const char **);
  int (*_wait)     (mu_stream_t, int *pflags, struct timeval *tvp);
};

#ifdef __cplusplus
}
#endif

#endif /* _STREAM0_H */

Return to:

Send suggestions and report system problems to the System administrator.