~ubuntu-branches/ubuntu/trusty/postgresql-8.4/trusty

« back to all changes in this revision

Viewing changes to contrib/pgcrypto/mbuf.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-11 16:59:35 UTC
  • mfrom: (5.1.1 karmic)
  • Revision ID: james.westby@ubuntu.com-20090711165935-jfwin6gfrxf0gfsi
Tags: 8.4.0-2
* debian/libpq-dev.install: Ship catalog/genbki.h. (Closes: #536139)
* debian/rules: Drop --enable-cassert for final release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
27
 * SUCH DAMAGE.
28
28
 *
29
 
 * $PostgreSQL: pgsql/contrib/pgcrypto/mbuf.h,v 1.2 2005/10/15 02:49:06 momjian Exp $
 
29
 * $PostgreSQL: pgsql/contrib/pgcrypto/mbuf.h,v 1.3 2009/06/11 14:48:52 momjian Exp $
30
30
 */
31
31
 
32
32
#ifndef __PX_MBUF_H
44
44
         * should return needed buffer size, 0- no buffering, <0 on error if NULL,
45
45
         * no buffering, and priv=init_arg
46
46
         */
47
 
        int                     (*init) (PushFilter * next, void *init_arg, void **priv_p);
 
47
        int                     (*init) (PushFilter *next, void *init_arg, void **priv_p);
48
48
 
49
49
        /*
50
50
         * send data to next.  should consume all? if null, it will be simply
51
51
         * copied (in-place) returns 0 on error
52
52
         */
53
 
        int                     (*push) (PushFilter * next, void *priv,
 
53
        int                     (*push) (PushFilter *next, void *priv,
54
54
                                                                         const uint8 *src, int len);
55
 
        int                     (*flush) (PushFilter * next, void *priv);
 
55
        int                     (*flush) (PushFilter *next, void *priv);
56
56
        void            (*free) (void *priv);
57
57
};
58
58
 
62
62
         * should return needed buffer size, 0- no buffering, <0 on error if NULL,
63
63
         * no buffering, and priv=init_arg
64
64
         */
65
 
        int                     (*init) (void **priv_p, void *init_arg, PullFilter * src);
 
65
        int                     (*init) (void **priv_p, void *init_arg, PullFilter *src);
66
66
 
67
67
        /*
68
68
         * request data from src, put result ptr to data_p can use ptr from src or
69
69
         * use buf as work area if NULL in-place copy
70
70
         */
71
 
        int                     (*pull) (void *priv, PullFilter * src, int len,
 
71
        int                     (*pull) (void *priv, PullFilter *src, int len,
72
72
                                                                         uint8 **data_p, uint8 *buf, int buflen);
73
73
        void            (*free) (void *priv);
74
74
};
78
78
 */
79
79
MBuf       *mbuf_create(int len);
80
80
MBuf       *mbuf_create_from_data(const uint8 *data, int len);
81
 
int                     mbuf_tell(MBuf * mbuf);
82
 
int                     mbuf_avail(MBuf * mbuf);
83
 
int                     mbuf_size(MBuf * mbuf);
84
 
int                     mbuf_grab(MBuf * mbuf, int len, uint8 **data_p);
85
 
int                     mbuf_steal_data(MBuf * mbuf, uint8 **data_p);
86
 
int                     mbuf_append(MBuf * dst, const uint8 *buf, int cnt);
87
 
int                     mbuf_rewind(MBuf * mbuf);
88
 
int                     mbuf_free(MBuf * mbuf);
 
81
int                     mbuf_tell(MBuf *mbuf);
 
82
int                     mbuf_avail(MBuf *mbuf);
 
83
int                     mbuf_size(MBuf *mbuf);
 
84
int                     mbuf_grab(MBuf *mbuf, int len, uint8 **data_p);
 
85
int                     mbuf_steal_data(MBuf *mbuf, uint8 **data_p);
 
86
int                     mbuf_append(MBuf *dst, const uint8 *buf, int cnt);
 
87
int                     mbuf_rewind(MBuf *mbuf);
 
88
int                     mbuf_free(MBuf *mbuf);
89
89
 
90
90
/*
91
91
 * Push filter
92
92
 */
93
 
int pushf_create(PushFilter ** res, const PushFilterOps * ops, void *init_arg,
94
 
                         PushFilter * next);
95
 
int                     pushf_write(PushFilter * mp, const uint8 *data, int len);
96
 
void            pushf_free_all(PushFilter * mp);
97
 
void            pushf_free(PushFilter * mp);
98
 
int                     pushf_flush(PushFilter * mp);
 
93
int pushf_create(PushFilter **res, const PushFilterOps *ops, void *init_arg,
 
94
                         PushFilter *next);
 
95
int                     pushf_write(PushFilter *mp, const uint8 *data, int len);
 
96
void            pushf_free_all(PushFilter *mp);
 
97
void            pushf_free(PushFilter *mp);
 
98
int                     pushf_flush(PushFilter *mp);
99
99
 
100
 
int                     pushf_create_mbuf_writer(PushFilter ** mp_p, MBuf * mbuf);
 
100
int                     pushf_create_mbuf_writer(PushFilter **mp_p, MBuf *mbuf);
101
101
 
102
102
/*
103
103
 * Pull filter
104
104
 */
105
 
int pullf_create(PullFilter ** res, const PullFilterOps * ops,
106
 
                         void *init_arg, PullFilter * src);
107
 
int                     pullf_read(PullFilter * mp, int len, uint8 **data_p);
108
 
int pullf_read_max(PullFilter * mp, int len,
 
105
int pullf_create(PullFilter **res, const PullFilterOps *ops,
 
106
                         void *init_arg, PullFilter *src);
 
107
int                     pullf_read(PullFilter *mp, int len, uint8 **data_p);
 
108
int pullf_read_max(PullFilter *mp, int len,
109
109
                           uint8 **data_p, uint8 *tmpbuf);
110
 
void            pullf_free(PullFilter * mp);
111
 
int                     pullf_read_fixed(PullFilter * src, int len, uint8 *dst);
 
110
void            pullf_free(PullFilter *mp);
 
111
int                     pullf_read_fixed(PullFilter *src, int len, uint8 *dst);
112
112
 
113
 
int                     pullf_create_mbuf_reader(PullFilter ** pf_p, MBuf * mbuf);
 
113
int                     pullf_create_mbuf_reader(PullFilter **pf_p, MBuf *mbuf);
114
114
 
115
115
#define GETBYTE(pf, dst) \
116
116
        do { \