OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
thrift_transport.h
Go to the documentation of this file.
1 /*
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
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  *
19  * Copyright 2006-2017 The Apache Software Foundation.
20  * https://github.com/apache/thrift
21  */
22 
23 #ifndef _THRIFT_TRANSPORT_H
24 #define _THRIFT_TRANSPORT_H
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
33 typedef enum {
38 
43 {
45  /* vtable */
46  int32_t (*read) (struct _ThriftTransport *transport, void *buf,
47  u_int32_t len, int *error);
48  u_int8_t (*write) (struct _ThriftTransport *transport, const void *buf,
49  const u_int32_t len, int *error);
50 };
52 
53 /* used by THRIFT_TYPE_TRANSPORT */
55 
56 /* virtual public methods */
57 
62 static inline int32_t
63 thrift_transport_read (ThriftTransport *transport, void *buf,
64  u_int32_t len, int *error)
65 {
66  return transport->read (transport, buf, len, error);
67 }
68 
73 static inline u_int8_t
74 thrift_transport_write (ThriftTransport *transport, const void *buf,
75  const u_int32_t len, int *error)
76 {
77  return transport->write (transport, buf, len, error);
78 }
79 
80 /* define error/exception types */
81 typedef enum
82 {
91 
92 #ifdef __cplusplus
93 }
94 #endif
95 
96 #endif /* _THRIFT_TRANSPORT_H */
ThriftTransportType thrift_transport_get_type(void)
ThriftTransportError
ThriftTransportType
ThriftTransportType ttype
int32_t(* read)(struct _ThriftTransport *transport, void *buf, u_int32_t len, int *error)
u_int8_t(* write)(struct _ThriftTransport *transport, const void *buf, const u_int32_t len, int *error)