~ubuntu-branches/ubuntu/utopic/dovecot/utopic-proposed

« back to all changes in this revision

Viewing changes to src/lib/istream.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-01-08 09:35:49 UTC
  • mfrom: (4.1.35 sid)
  • Revision ID: package-import@ubuntu.com-20140108093549-i72o93pux8p0dlaf
Tags: 1:2.2.9-1ubuntu1
* Merge from Debian unstable, remaining changes:
  + Add mail-stack-delivery package:
    - Update d/rules
    - d/control: convert existing dovecot-postfix package to a dummy
      package and add new mail-stack-delivery package.
    - Update maintainer scripts.
    - Rename d/dovecot-postfix.* to debian/mail-stack-delivery.*
    - d/mail-stack-delivery.preinst: Move previously installed backups and
      config files to a new package namespace.
    - d/mail-stack-delivery.prerm: Added to handle downgrades.
  + Use Snakeoil SSL certificates by default:
    - d/control: Depend on ssl-cert.
    - d/dovecot-core.postinst: Relax grep for SSL_* a bit.
  + Add autopkgtest to debian/tests/*.
  + Add ufw integration:
    - d/dovecot-core.ufw.profile: new ufw profile.
    - d/rules: install profile in dovecot-core.
    - d/control: dovecot-core - suggest ufw.
  + d/dovecot-core.dirs: Added usr/share/doc/dovecot-core
  + Add apport hook:
    - d/rules, d/source_dovecot.py
  + Add upstart job:
    - d/rules, d/dovecot-core.dovecot.upstart, d/control,
      d/dovecot-core.dirs, dovecot-imapd.{postrm, postinst, prerm},
      d/dovecot-pop3d.{postinst, postrm, prerm}.
      d/mail-stack-deliver.postinst: Convert init script to upstart.
  + Use the autotools-dev dh addon to update config.guess/config.sub for
    arm64.
* Dropped changes, included in Debian:
  - Update Dovecot name to reflect distribution in login greeting.
  - Update Drac plugin for >= 2.0.0 support.
* d/control: Drop dovecot-postfix package as its no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
                                     bool autoclose_fd);
33
33
struct istream *i_stream_create_from_data(const void *data, size_t size);
34
34
struct istream *i_stream_create_limit(struct istream *input, uoff_t v_size);
 
35
struct istream *i_stream_create_range(struct istream *input,
 
36
                                      uoff_t v_offset, uoff_t v_size);
 
37
struct istream *i_stream_create_error(int stream_errno);
 
38
struct istream *
 
39
i_stream_create_error_str(int stream_errno, const char *fmt, ...)
 
40
        ATTR_FORMAT(2, 3);
35
41
 
36
42
/* Set name (e.g. path) for input stream. */
37
43
void i_stream_set_name(struct istream *stream, const char *name);
40
46
   Returns "" if stream has no name. */
41
47
const char *i_stream_get_name(struct istream *stream);
42
48
 
43
 
/* i_stream_close() + i_stream_unref() */
 
49
/* Close this stream (but not its parents) and unreference it. */
44
50
void i_stream_destroy(struct istream **stream);
45
51
 
46
52
/* Reference counting. References start from 1, so calling i_stream_unref()
49
55
/* Unreferences the stream and sets stream pointer to NULL. */
50
56
void i_stream_unref(struct istream **stream);
51
57
/* Call the given callback function when stream is destroyed. */
52
 
void i_stream_set_destroy_callback(struct istream *stream,
53
 
                                   istream_callback_t *callback, void *context);
54
 
#define i_stream_set_destroy_callback(stream, callback, context) \
55
 
        CONTEXT_CALLBACK(i_stream_set_destroy_callback, istream_callback_t, \
56
 
                         callback, context, stream)
 
58
void i_stream_add_destroy_callback(struct istream *stream,
 
59
                                   istream_callback_t *callback, void *context)
 
60
        ATTR_NULL(3);
 
61
#define i_stream_add_destroy_callback(stream, callback, context) \
 
62
        i_stream_add_destroy_callback(stream + \
 
63
                CALLBACK_TYPECHECK(callback, void (*)(typeof(context))), \
 
64
                (istream_callback_t *)callback, context)
57
65
/* Remove the destroy callback. */
58
 
void i_stream_unset_destroy_callback(struct istream *stream);
 
66
void i_stream_remove_destroy_callback(struct istream *stream,
 
67
                                      void (*callback)());
59
68
 
60
69
/* Return file descriptor for stream, or -1 if none is available. */
61
70
int i_stream_get_fd(struct istream *stream);
 
71
/* Returns error string for the last error. */
 
72
const char *i_stream_get_error(struct istream *stream);
62
73
 
63
 
/* Mark the stream closed. Any reads after this will return -1. The data
64
 
   already read can still be used. */
 
74
/* Mark the stream and all of its parent streams closed. Any reads after this
 
75
   will return -1. The data already read can still be used. */
65
76
void i_stream_close(struct istream *stream);
66
77
/* Sync the stream with the underlying backend, ie. if a file has been
67
78
   modified, flush any cached data. */
94
105
   stream's implementation is slow in seeking backwards, it can use this hint
95
106
   to cache some of the data in memory. */
96
107
void i_stream_seek_mark(struct istream *stream, uoff_t v_offset);
97
 
/* Returns struct stat, or NULL if error. As the underlying stream may not be
 
108
/* Returns 0 if ok, -1 if error. As the underlying stream may not be
98
109
   a file, only some of the fields might be set, others would be zero.
99
110
   st_size is always set, and if it's not known, it's -1.
100
111
 
101
112
   If exact=FALSE, the stream may not return exactly correct values, but the
102
113
   returned values can be compared to see if anything had changed (eg. in
103
114
   compressed stream st_size could be compressed size) */
104
 
const struct stat *i_stream_stat(struct istream *stream, bool exact);
 
115
int i_stream_stat(struct istream *stream, bool exact, const struct stat **st_r);
105
116
/* Similar to i_stream_stat() call. Returns 1 if size was successfully
106
117
   set, 0 if size is unknown, -1 if error. */
107
118
int i_stream_get_size(struct istream *stream, bool exact, uoff_t *size_r);
118
129
   if the last line should be returned if it doesn't end with LF. */
119
130
char *i_stream_next_line(struct istream *stream);
120
131
/* Like i_stream_next_line(), but reads for more data if needed. Returns NULL
121
 
   if more data is needed or error occurred. */
 
132
   if more data is needed or error occurred. If the input buffer gets full,
 
133
   stream_errno is set to ENOBUFS. */
122
134
char *i_stream_read_next_line(struct istream *stream);
 
135
/* Returns TRUE if the last line read with i_stream_next_line() ended with
 
136
   CRLF (instead of LF). */
 
137
bool i_stream_last_line_crlf(struct istream *stream);
123
138
 
124
139
/* Returns pointer to beginning of read data, or NULL if there's no data
125
140
   buffered. */
126
141
const unsigned char *
127
142
i_stream_get_data(const struct istream *stream, size_t *size_r);
 
143
size_t i_stream_get_data_size(const struct istream *stream);
128
144
/* Like i_stream_get_data(), but returns non-const data. This only works with
129
145
   buffered streams (currently only file), others return NULL. */
130
146
unsigned char *i_stream_get_modifiable_data(const struct istream *stream,