1 /* $NetBSD: netstring.h,v 1.1.1.2 2013/09/25 19:06:37 tron Exp $ */ 2 3 #ifndef _NETSTRING_H_INCLUDED_ 4 #define _NETSTRING_H_INCLUDED_ 5 6 /*++ 7 /* NAME 8 /* netstring 3h 9 /* SUMMARY 10 /* netstring stream I/O support 11 /* SYNOPSIS 12 /* #include <netstring.h> 13 /* DESCRIPTION 14 /* .nf 15 16 /* 17 * Utility library. 18 */ 19 #include <vstring.h> 20 #include <vstream.h> 21 22 /* 23 * External interface. 24 */ 25 #define NETSTRING_ERR_EOF 1 /* unexpected disconnect */ 26 #define NETSTRING_ERR_TIME 2 /* time out */ 27 #define NETSTRING_ERR_FORMAT 3 /* format error */ 28 #define NETSTRING_ERR_SIZE 4 /* netstring too large */ 29 30 extern void netstring_except(VSTREAM *, int); 31 extern void netstring_setup(VSTREAM *, int); 32 extern ssize_t netstring_get_length(VSTREAM *); 33 extern VSTRING *netstring_get_data(VSTREAM *, VSTRING *, ssize_t); 34 extern void netstring_get_terminator(VSTREAM *); 35 extern VSTRING *netstring_get(VSTREAM *, VSTRING *, ssize_t); 36 extern void netstring_put(VSTREAM *, const char *, ssize_t); 37 extern void netstring_put_multi(VSTREAM *,...); 38 extern void netstring_fflush(VSTREAM *); 39 extern VSTRING *netstring_memcpy(VSTRING *, const char *, ssize_t); 40 extern VSTRING *netstring_memcat(VSTRING *, const char *, ssize_t); 41 extern const char *netstring_strerror(int); 42 43 #define NETSTRING_PUT_BUF(str, buf) \ 44 netstring_put((str), vstring_str(buf), VSTRING_LEN(buf)) 45 46 /* LICENSE 47 /* .ad 48 /* .fi 49 /* The Secure Mailer license must be distributed with this software. 50 /* AUTHOR(S) 51 /* Wietse Venema 52 /* IBM T.J. Watson Research 53 /* P.O. Box 704 54 /* Yorktown Heights, NY 10598, USA 55 /*--*/ 56 57 #endif 58