C AMQP Protocol Engine API  0.5
proton/framing.h
Go to the documentation of this file.
00001 #ifndef PROTON_FRAMING_H
00002 #define PROTON_FRAMING_H 1
00003 
00004 /*
00005  *
00006  * Licensed to the Apache Software Foundation (ASF) under one
00007  * or more contributor license agreements.  See the NOTICE file
00008  * distributed with this work for additional information
00009  * regarding copyright ownership.  The ASF licenses this file
00010  * to you under the Apache License, Version 2.0 (the
00011  * "License"); you may not use this file except in compliance
00012  * with the License.  You may obtain a copy of the License at
00013  *
00014  *   http://www.apache.org/licenses/LICENSE-2.0
00015  *
00016  * Unless required by applicable law or agreed to in writing,
00017  * software distributed under the License is distributed on an
00018  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00019  * KIND, either express or implied.  See the License for the
00020  * specific language governing permissions and limitations
00021  * under the License.
00022  *
00023  */
00024 
00025 #include <proton/import_export.h>
00026 #ifndef __cplusplus
00027 #include <stdint.h>
00028 #else
00029 #include <proton/type_compat.h>
00030 #endif
00031 #include <sys/types.h>
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036 
00037 #define AMQP_HEADER_SIZE (8)
00038 #define AMQP_MIN_MAX_FRAME_SIZE ((uint32_t)512) // minimum allowable max-frame
00039 
00040 typedef struct {
00041   uint8_t type;
00042   uint16_t channel;
00043   size_t ex_size;
00044   const char *extended;
00045   size_t size;
00046   const char *payload;
00047 } pn_frame_t;
00048 
00049 PN_EXTERN size_t pn_read_frame(pn_frame_t *frame, const char *bytes, size_t available);
00050 PN_EXTERN size_t pn_write_frame(char *bytes, size_t size, pn_frame_t frame);
00051 
00052 #ifdef __cplusplus
00053 }
00054 #endif
00055 
00056 #endif /* framing.h */