nmsg  0.14.0
strbuf.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009-2015 by Farsight Security, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef NMSG_STRBUF_H
18 #define NMSG_STRBUF_H
19 
27 struct nmsg_strbuf {
28  char *pos; /*%< end of string */
29  char *data; /*%< buffer for string data */
30  size_t bufsz; /*%< size of data allocation */
31 };
32 
38 struct nmsg_strbuf *nmsg_strbuf_init(void);
39 
45 void nmsg_strbuf_destroy(struct nmsg_strbuf **sb);
46 
60 nmsg_res nmsg_strbuf_append(struct nmsg_strbuf *sb, const char *fmt, ...);
61 
74 
82 size_t nmsg_strbuf_len(struct nmsg_strbuf *sb);
83 
84 #endif /* NMSG_STRBUF_H */