2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 #ifndef __RECORDIO_H__
19 #define __RECORDIO_H__
21 #include <sys/types.h>
32 void deallocate_String(char **s);
33 void deallocate_Buffer(struct buffer *b);
34 void deallocate_vector(void *d);
36 int (*start_record)(struct iarchive *ia, const char *tag);
37 int (*end_record)(struct iarchive *ia, const char *tag);
38 int (*start_vector)(struct iarchive *ia, const char *tag, int32_t *count);
39 int (*end_vector)(struct iarchive *ia, const char *tag);
40 int (*deserialize_Bool)(struct iarchive *ia, const char *name, int32_t *);
41 int (*deserialize_Int)(struct iarchive *ia, const char *name, int32_t *);
42 int (*deserialize_Long)(struct iarchive *ia, const char *name, int64_t *);
43 int (*deserialize_Buffer)(struct iarchive *ia, const char *name,
45 int (*deserialize_String)(struct iarchive *ia, const char *name, char **);
49 int (*start_record)(struct oarchive *oa, const char *tag);
50 int (*end_record)(struct oarchive *oa, const char *tag);
51 int (*start_vector)(struct oarchive *oa, const char *tag, const int32_t *count);
52 int (*end_vector)(struct oarchive *oa, const char *tag);
53 int (*serialize_Bool)(struct oarchive *oa, const char *name, const int32_t *);
54 int (*serialize_Int)(struct oarchive *oa, const char *name, const int32_t *);
55 int (*serialize_Long)(struct oarchive *oa, const char *name,
57 int (*serialize_Buffer)(struct oarchive *oa, const char *name,
58 const struct buffer *);
59 int (*serialize_String)(struct oarchive *oa, const char *name, char **);
63 struct oarchive *create_buffer_oarchive(void);
64 void close_buffer_oarchive(struct oarchive **oa, int free_buffer);
65 struct iarchive *create_buffer_iarchive(char *buffer, int len);
66 void close_buffer_iarchive(struct iarchive **ia);
67 char *get_buffer(struct oarchive *);
68 int get_buffer_len(struct oarchive *);
70 int64_t htonll(int64_t v);