source: include/vsb.h @ c11726

Revision c11726, 3.3 KB checked in by Poul-Henning Kamp <phk@…>, 3 years ago (diff)

Update copyright notices to reflect development and copyright assignment
from Redpill Linpro AS to Varnish Software AS

  • Property mode set to 100644
Line 
1/*-
2 * Copyright (c) 2000-2011 Poul-Henning Kamp
3 * Copyright (c) 2000-2008 Dag-Erling Coïdan Smørgrav
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer
11 *    in this position and unchanged.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 *      $FreeBSD: head/sys/sys/vsb.h 221993 2011-05-16 16:18:40Z phk $
29 */
30
31#ifndef VSB_H_INCLUDED
32#define VSB_H_INCLUDED
33
34#include <sys/types.h>
35
36/*
37 * Structure definition
38 */
39struct vsb {
40        unsigned        s_magic;
41        char            *s_buf;         /* storage buffer */
42        int              s_error;       /* current error code */
43        ssize_t          s_size;        /* size of storage buffer */
44        ssize_t          s_len;         /* current length of string */
45#define VSB_FIXEDLEN    0x00000000      /* fixed length buffer (default) */
46#define VSB_AUTOEXTEND  0x00000001      /* automatically extend buffer */
47#define VSB_USRFLAGMSK  0x0000ffff      /* mask of flags the user may specify */
48#define VSB_DYNAMIC     0x00010000      /* s_buf must be freed */
49#define VSB_FINISHED    0x00020000      /* set by VSB_finish() */
50#define VSB_DYNSTRUCT   0x00080000      /* vsb must be freed */
51        int              s_flags;       /* flags */
52};
53
54#ifndef __printflike
55#define __printflike(a,b)
56#endif
57
58#ifdef __cplusplus
59extern "C" {
60#endif
61/*
62 * API functions
63 */
64struct vsb      *VSB_new(struct vsb *, char *, int, int);
65#define          VSB_new_auto()                         \
66        VSB_new(NULL, NULL, 0, VSB_AUTOEXTEND)
67void             VSB_clear(struct vsb *);
68int              VSB_setpos(struct vsb *, ssize_t);
69int              VSB_bcat(struct vsb *, const void *, size_t);
70int              VSB_bcpy(struct vsb *, const void *, size_t);
71int              VSB_cat(struct vsb *, const char *);
72int              VSB_cpy(struct vsb *, const char *);
73int              VSB_printf(struct vsb *, const char *, ...)
74        __printflike(2, 3);
75#ifdef va_start
76int              VSB_vprintf(struct vsb *, const char *, va_list)
77        __printflike(2, 0);
78#endif
79int              VSB_putc(struct vsb *, int);
80int              VSB_trim(struct vsb *);
81int              VSB_error(const struct vsb *);
82int              VSB_finish(struct vsb *);
83char            *VSB_data(struct vsb *);
84ssize_t          VSB_len(struct vsb *);
85int              VSB_done(const struct vsb *);
86void             VSB_delete(struct vsb *);
87void             VSB_quote(struct vsb *s, const char *p, int len, int how);
88const char      *VSB_unquote(struct vsb *s, const char *p, int len, int how);
89#ifdef __cplusplus
90};
91#endif
92
93#endif
Note: See TracBrowser for help on using the repository browser.