~ubuntu-branches/ubuntu/utopic/libesmtp/utopic

« back to all changes in this revision

Viewing changes to siobuf.h

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy T. Bouse
  • Date: 2002-03-06 08:37:48 UTC
  • Revision ID: james.westby@ubuntu.com-20020306083748-ihmt32mddsslvg5i
Tags: upstream-0.8.11
ImportĀ upstreamĀ versionĀ 0.8.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _siobuf_h
 
2
#define _siobuf_h
 
3
/*
 
4
 *  This file is part of libESMTP, a library for submission of RFC 2822
 
5
 *  formatted electronic mail messages using the SMTP protocol described
 
6
 *  in RFC 2821.
 
7
 *
 
8
 *  Copyright (C) 2001,2002  Brian Stafford  <brian@stafford.uklinux.net>
 
9
 *
 
10
 *  This library is free software; you can redistribute it and/or
 
11
 *  modify it under the terms of the GNU Lesser General Public
 
12
 *  License as published by the Free Software Foundation; either
 
13
 *  version 2.1 of the License, or (at your option) any later version.
 
14
 *
 
15
 *  This library is distributed in the hope that it will be useful,
 
16
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
18
 *  Lesser General Public License for more details.
 
19
 *
 
20
 *  You should have received a copy of the GNU Lesser General Public
 
21
 *  License along with this library; if not, write to the Free Software
 
22
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
23
 */
 
24
 
 
25
typedef struct siobuf *siobuf_t;
 
26
 
 
27
#define SIO_BUFSIZE     2048 /* arbitrary, not too short, not too long */
 
28
#define SIO_READ        1
 
29
#define SIO_WRITE       2
 
30
 
 
31
typedef void (*recodecb_t) (char **dstbuf, int *dstlen,
 
32
                            const char *srcbuf, int srclen, void *arg);
 
33
typedef void (*monitorcb_t) (const char *buffer, int length, int direction,
 
34
                             void *arg);
 
35
 
 
36
struct siobuf *sio_attach(int sdr, int sdw, int buffer_size);
 
37
void sio_detach(struct siobuf *sio);
 
38
void sio_set_monitorcb(struct siobuf *sio, monitorcb_t cb, void *arg);
 
39
void sio_set_timeout(struct siobuf *sio, int milliseconds);
 
40
void sio_set_securitycb(struct siobuf *sio, recodecb_t encode_cb,
 
41
                        recodecb_t decode_cb, void *arg);
 
42
int sio_poll(struct siobuf *sio,int want_read, int want_write, int fast);
 
43
void sio_write(struct siobuf *sio, const void *bufp, int buflen);
 
44
void sio_flush(struct siobuf *sio);
 
45
void sio_mark(struct siobuf *sio);
 
46
int sio_fill(struct siobuf *sio);
 
47
int sio_read(struct siobuf *sio, void *bufp, int buflen);
 
48
char *sio_gets(struct siobuf *sio, char buf[], int buflen);
 
49
int sio_printf(struct siobuf *sio, const char *format, ...)
 
50
               __attribute__ ((format (printf, 2, 3))) ;
 
51
 
 
52
 
 
53
#ifdef USE_TLS
 
54
int sio_set_tlsclient_ssl (struct siobuf *sio, SSL *ssl);
 
55
#endif
 
56
#endif