1*ae886706Smillert /* $OpenBSD: buf.h,v 1.29 2016/10/15 22:20:17 millert Exp $ */ 26c121f58Sjfb /* 3f3d6a35aSjfb * Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org> 46c121f58Sjfb * All rights reserved. 56c121f58Sjfb * 66c121f58Sjfb * Redistribution and use in source and binary forms, with or without 76c121f58Sjfb * modification, are permitted provided that the following conditions 86c121f58Sjfb * are met: 96c121f58Sjfb * 106c121f58Sjfb * 1. Redistributions of source code must retain the above copyright 116c121f58Sjfb * notice, this list of conditions and the following disclaimer. 126c121f58Sjfb * 2. The name of the author may not be used to endorse or promote products 136c121f58Sjfb * derived from this software without specific prior written permission. 146c121f58Sjfb * 156c121f58Sjfb * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 166c121f58Sjfb * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 176c121f58Sjfb * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 186c121f58Sjfb * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 196c121f58Sjfb * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 206c121f58Sjfb * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 216c121f58Sjfb * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 226c121f58Sjfb * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 236c121f58Sjfb * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 246c121f58Sjfb * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 256c121f58Sjfb */ 266c121f58Sjfb 276c121f58Sjfb #ifndef BUF_H 286c121f58Sjfb #define BUF_H 296c121f58Sjfb 301f8531bdSotto #include <sys/types.h> 311f8531bdSotto 327bb3ddb0Sray typedef struct buf BUF; 33*ae886706Smillert struct timeval; 346c121f58Sjfb 357bb3ddb0Sray BUF *buf_alloc(size_t); 367bb3ddb0Sray BUF *buf_load(const char *); 377bb3ddb0Sray BUF *buf_load_fd(int); 387bb3ddb0Sray void buf_free(BUF *); 39490e89adSzinovik void *buf_release(BUF *); 407bb3ddb0Sray u_char *buf_get(BUF *); 417bb3ddb0Sray void buf_append(BUF *, const void *, size_t); 427bb3ddb0Sray void buf_putc(BUF *, int); 437bb3ddb0Sray void buf_puts(BUF *, const char *); 447bb3ddb0Sray size_t buf_len(BUF *); 457bb3ddb0Sray int buf_write_fd(BUF *, int); 467bb3ddb0Sray int buf_write(BUF *, const char *, mode_t); 477bb3ddb0Sray int buf_differ(const BUF *, const BUF *); 487bb3ddb0Sray int buf_write_stmp(BUF *, char *, struct timeval *); 493ad3fb45Sjoris 506c121f58Sjfb #endif /* BUF_H */ 51