| 1 |
#ifndef PROTON_FRAMING_H |
| 2 |
#define PROTON_FRAMING_H 1 |
| 3 |
|
| 4 |
/* |
| 5 |
* |
| 6 |
* Licensed to the Apache Software Foundation (ASF) under one |
| 7 |
* or more contributor license agreements. See the NOTICE file |
| 8 |
* distributed with this work for additional information |
| 9 |
* regarding copyright ownership. The ASF licenses this file |
| 10 |
* to you under the Apache License, Version 2.0 (the |
| 11 |
* "License"); you may not use this file except in compliance |
| 12 |
* with the License. You may obtain a copy of the License at |
| 13 |
* |
| 14 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 15 |
* |
| 16 |
* Unless required by applicable law or agreed to in writing, |
| 17 |
* software distributed under the License is distributed on an |
| 18 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 19 |
* KIND, either express or implied. See the License for the |
| 20 |
* specific language governing permissions and limitations |
| 21 |
* under the License. |
| 22 |
* |
| 23 |
*/ |
| 24 |
|
| 25 |
#include "buffer.h" |
| 26 |
#include "logger_private.h" |
| 27 |
|
| 28 |
#include "proton/codec.h" |
| 29 |
#include "proton/types.h" |
| 30 |
|
| 31 |
#include <stddef.h> |
| 32 |
|
| 33 |
#define AMQP_HEADER_SIZE (8) |
| 34 |
#define AMQP_MIN_MAX_FRAME_SIZE ((uint32_t)512) // minimum allowable max-frame |
| 35 |
#define AMQP_MAX_WINDOW_SIZE (2147483647) |
| 36 |
|
| 37 |
#define AMQP_FRAME_TYPE (0) |
| 38 |
#define SASL_FRAME_TYPE (1) |
| 39 |
|
| 40 |
typedef struct { |
| 41 |
uint8_t type; |
| 42 |
uint16_t channel; |
| 43 |
pn_bytes_t extended; |
| 44 |
pn_bytes_t frame_payload0; |
| 45 |
pn_bytes_t frame_payload1; |
| 46 |
} pn_frame_t; |
| 47 |
|
| 48 |
ssize_t pn_read_frame(pn_frame_t *frame, const char *bytes, size_t available, uint32_t max, pn_logger_t *logger); |
| 49 |
size_t pn_write_frame(pn_buffer_t* buffer, pn_frame_t frame, pn_logger_t *logger); |
| 50 |
|
| 51 |
int pn_framing_send_amqp(pn_transport_t *transport, uint16_t ch, pn_bytes_t performative); |
| 52 |
int pn_framing_send_amqp_with_payload(pn_transport_t *transport, uint16_t ch, pn_bytes_t performative, pn_bytes_t payload); |
| 53 |
int pn_framing_send_sasl(pn_transport_t *transport, pn_bytes_t performative); |
| 54 |
|
| 55 |
ssize_t pn_framing_recv_amqp(pn_data_t *args, pn_logger_t *logger, const pn_bytes_t frame_payload); |
| 56 |
|
| 57 |
#endif /* framing.h */ |