1%%% This code was developped by Zhihui Jiao(jzhihui521@gmail.com). 2%%% 3%%% Copyright (C) 2013 Zhihui Jiao 4%%% 5%%% This program is free software; you can redistribute it and/or modify 6%%% it under the terms of the GNU General Public License as published by 7%%% the Free Software Foundation; either version 2 of the License, or 8%%% (at your option) any later version. 9%%% 10%%% This program is distributed in the hope that it will be useful, 11%%% but WITHOUT ANY WARRANTY; without even the implied warranty of 12%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13%%% GNU General Public License for more details. 14%%% 15%%% You should have received a copy of the GNU General Public License 16%%% along with this program; if not, write to the Free Software 17%%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 18%%% 19%%% In addition, as a special exception, you have the permission to 20%%% link the code of this program with any library released under 21%%% the EPL license and distribute linked combinations including 22%%% the two; the MPL (Mozilla Public License), which EPL (Erlang 23%%% Public License) is based on, is included in this exception. 24 25-vc('$Id$ '). 26-author('jzhihui521@gmail.com'). 27 28-define(AMQP_USER, "guest"). 29-define(AMQP_PASSWORD, "guest"). 30 31-define(PROTOCOL_VERSION_MAJOR, 0). 32-define(PROTOCOL_VERSION_MINOR, 9). 33-define(PROTOCOL_HEADER, <<"AMQP", 0, 0, 9, 1>>). 34-define(PROTOCOL, rabbit_framing_amqp_0_9_1). 35-define(MAX_CHANNEL_NUMBER, 65535). 36 37-define(CLIENT_CAPABILITIES, [{<<"publisher_confirms">>, bool, true}, 38 {<<"exchange_exchange_bindings">>, bool, true}, 39 {<<"basic.nack">>, bool, true}, 40 {<<"consumer_cancel_notify">>, bool, true}]). 41 42%% use by the client to create the request 43-record(amqp_request, { 44 version = "0_9_1", % default is 0.9.1 45 type, 46 username, 47 password, 48 heartbeat, 49 vhost, 50 channel = "1", 51 exchange, 52 routing_key, 53 confirm, 54 prefetch_size, 55 prefetch_count, 56 persistent, 57 payload, 58 payload_size, 59 queue, 60 ack 61 }). 62 63-record(amqp_dyndata, { 64 none 65 } 66 ). 67 68-record(ch, { 69 ack, 70 next_pub_seqno, 71 unconfirmed_set 72 } 73 ). 74 75-record(amqp_session, { 76 vhost, 77 protocol, 78 channel_max = 65535, 79 map_num_pa, 80 ack_buf, 81 status, % status of handshake 82 waiting = none % waiting state: {Channel, Expecting} 83 }). 84 85