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