1*e6ca80d4Stron /* $NetBSD: netstring.h,v 1.1.1.2 2013/09/25 19:06:37 tron Exp $ */ 241fbaed0Stron 341fbaed0Stron #ifndef _NETSTRING_H_INCLUDED_ 441fbaed0Stron #define _NETSTRING_H_INCLUDED_ 541fbaed0Stron 641fbaed0Stron /*++ 741fbaed0Stron /* NAME 841fbaed0Stron /* netstring 3h 941fbaed0Stron /* SUMMARY 1041fbaed0Stron /* netstring stream I/O support 1141fbaed0Stron /* SYNOPSIS 1241fbaed0Stron /* #include <netstring.h> 1341fbaed0Stron /* DESCRIPTION 1441fbaed0Stron /* .nf 1541fbaed0Stron 1641fbaed0Stron /* 1741fbaed0Stron * Utility library. 1841fbaed0Stron */ 1941fbaed0Stron #include <vstring.h> 2041fbaed0Stron #include <vstream.h> 2141fbaed0Stron 2241fbaed0Stron /* 2341fbaed0Stron * External interface. 2441fbaed0Stron */ 2541fbaed0Stron #define NETSTRING_ERR_EOF 1 /* unexpected disconnect */ 2641fbaed0Stron #define NETSTRING_ERR_TIME 2 /* time out */ 2741fbaed0Stron #define NETSTRING_ERR_FORMAT 3 /* format error */ 2841fbaed0Stron #define NETSTRING_ERR_SIZE 4 /* netstring too large */ 2941fbaed0Stron 3041fbaed0Stron extern void netstring_except(VSTREAM *, int); 3141fbaed0Stron extern void netstring_setup(VSTREAM *, int); 3241fbaed0Stron extern ssize_t netstring_get_length(VSTREAM *); 3341fbaed0Stron extern VSTRING *netstring_get_data(VSTREAM *, VSTRING *, ssize_t); 3441fbaed0Stron extern void netstring_get_terminator(VSTREAM *); 3541fbaed0Stron extern VSTRING *netstring_get(VSTREAM *, VSTRING *, ssize_t); 3641fbaed0Stron extern void netstring_put(VSTREAM *, const char *, ssize_t); 3741fbaed0Stron extern void netstring_put_multi(VSTREAM *,...); 3841fbaed0Stron extern void netstring_fflush(VSTREAM *); 3941fbaed0Stron extern VSTRING *netstring_memcpy(VSTRING *, const char *, ssize_t); 4041fbaed0Stron extern VSTRING *netstring_memcat(VSTRING *, const char *, ssize_t); 41*e6ca80d4Stron extern const char *netstring_strerror(int); 4241fbaed0Stron 4341fbaed0Stron #define NETSTRING_PUT_BUF(str, buf) \ 4441fbaed0Stron netstring_put((str), vstring_str(buf), VSTRING_LEN(buf)) 4541fbaed0Stron 4641fbaed0Stron /* LICENSE 4741fbaed0Stron /* .ad 4841fbaed0Stron /* .fi 4941fbaed0Stron /* The Secure Mailer license must be distributed with this software. 5041fbaed0Stron /* AUTHOR(S) 5141fbaed0Stron /* Wietse Venema 5241fbaed0Stron /* IBM T.J. Watson Research 5341fbaed0Stron /* P.O. Box 704 5441fbaed0Stron /* Yorktown Heights, NY 10598, USA 5541fbaed0Stron /*--*/ 5641fbaed0Stron 5741fbaed0Stron #endif 58