Packages

rabbit_common

3.7.4
4.2.1 4.2.0 retired 4.2.0-rc.1 retired 4.1.6 4.1.5 retired 4.1.5-rc.2 retired 4.1.5-rc.1 4.0.3 4.0.3-rc.1 4.0.2 4.0.2-rc.2 4.0.2-rc.1 4.0.1 4.0.0 4.0.0-rc.2 4.0.0-rc.1 3.13.7 3.13.6 3.13.5 3.13.4 3.13.3 3.13.2 3.13.2-rc.1 3.13.1 3.13.0 3.13.0-rc.6 3.13.0-rc.5 3.13.0-rc.4 3.13.0-rc.3 3.13.0-rc.2 3.13.0-rc.1 3.12.14 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.2 3.12.1 3.12.0 3.12.0-rc.4 3.12.0-rc.3 3.12.0-rc.2 3.12.0-rc.1 3.11.28 3.11.27 3.11.26 3.11.25 3.11.24 3.11.23 3.11.22 3.11.21 3.11.20 3.11.19 3.11.18 3.11.17 3.11.16 3.11.15 3.11.14 3.11.13 3.11.12 3.11.11 3.11.10 3.11.9 3.11.8 3.11.7 3.11.6 3.11.5 3.11.4 3.11.3 3.11.2 3.11.1 3.11.0 3.11.0-rc.2 3.11.0-rc.1 3.11.0-1 3.10.25 3.10.24 3.10.23 3.10.22 3.10.21 3.10.20 3.10.19 3.10.18 3.10.17 3.10.16 3.10.15 3.10.14 3.10.13 3.10.12 3.10.11 3.10.10 3.10.9 3.10.8 3.10.7 3.10.6 3.10.5 3.10.4 3.10.3 3.10.2 3.10.1 3.10.0 3.10.0-rc.6 3.10.0-rc.5 3.9.29 3.9.28 3.9.27 3.9.26 3.9.25 3.9.24 3.9.23 3.9.22 3.9.21 3.9.20 3.9.19 3.9.18 3.9.17 3.9.16 3.9.15 3.9.11 3.9.10 3.9.9 3.9.8 3.9.7 3.9.6 3.9.5 3.9.4 3.9.3 3.9.2 3.9.1 3.8.35 3.8.34 3.8.33 3.8.32 3.8.31 3.8.30 3.8.26 3.8.25 3.8.24 3.8.23 3.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c.2 3.7.0-alpha.544 3.7.0-alpha.542 3.6.16 3.6.16-rc.1 3.6.15 3.6.15-rc.1 3.6.14 3.6.13 3.6.12 3.6.11 3.6.10 3.6.9 3.6.8 3.6.7 3.6.7-pre.1 3.5.6 3.5.0 3.4.0 3.3.5 3.0.2 0.0.0-rc.1

Modules shared by rabbitmq-server and rabbitmq-erlang-client

Security advisory: This version has known vulnerabilities. View advisories

Current section

Files

Jump to
rabbit_common include rabbit.hrl
Raw

include/rabbit.hrl

%% The contents of this file are subject to the Mozilla Public License
%% Version 1.1 (the "License"); you may not use this file except in
%% compliance with the License. You may obtain a copy of the License
%% at http://www.mozilla.org/MPL/
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and
%% limitations under the License.
%%
%% The Original Code is RabbitMQ.
%%
%% The Initial Developer of the Original Code is Pivotal Software, Inc.
%% Copyright (c) 2007-2017 Pivotal Software, Inc. All rights reserved.
%%
%% Passed around most places
-record(user, {username,
tags,
authz_backends}). %% List of {Module, AuthUserImpl} pairs
%% Passed to auth backends
-record(auth_user, {username,
tags,
impl}).
%% Passed to authz backends.
-record(authz_socket_info, {sockname, peername}).
%% Implementation for the internal auth backend
-record(internal_user, {
username,
password_hash,
tags,
%% password hashing implementation module,
%% typically rabbit_password_hashing_* but can
%% come from a plugin
hashing_algorithm}).
-record(permission, {configure, write, read}).
-record(user_vhost, {username, virtual_host}).
-record(user_permission, {user_vhost, permission}).
-record(topic_permission_key, {user_vhost, exchange}).
-record(topic_permission, {topic_permission_key, permission}).
%% Represents a vhost.
%%
%% Historically this record had 2 arguments although the 2nd
%% was never used (`dummy`, always undefined). This is because
%% single field records were/are illegal in OTP.
%%
%% As of 3.6.x, the second argument is vhost limits,
%% which is actually used and has the same default.
%% Nonetheless, this required a migration, see rabbit_upgrade_functions.
-record(vhost, {
%% vhost name as a binary
virtual_host,
%% proplist of limits configured, if any
limits}).
%% Client connection, used by rabbit_reader
%% and related modules.
-record(connection, {
%% e.g. <<"127.0.0.1:55054 -> 127.0.0.1:5672">>
name,
%% used for logging: same as `name`, but optionally
%% augmented with user-supplied name
log_name,
%% server host
host,
%% client host
peer_host,
%% server port
port,
%% client port
peer_port,
%% protocol implementation module,
%% e.g. rabbit_framing_amqp_0_9_1
protocol,
user,
%% heartbeat timeout value used, 0 means
%% heartbeats are disabled
timeout_sec,
%% maximum allowed frame size,
%% see frame_max in the AMQP 0-9-1 spec
frame_max,
%% greatest channel number allowed,
%% see channel_max in the AMQP 0-9-1 spec
channel_max,
vhost,
%% client name, version, platform, etc
client_properties,
%% what lists protocol extensions
%% does this client support?
capabilities,
%% authentication mechanism used
%% as a pair of {Name, Module}
auth_mechanism,
%% authentication mechanism state,
%% initialised by rabbit_auth_mechanism:init/1
%% implementations
auth_state,
%% time of connection
connected_at}).
-record(content,
{class_id,
properties, %% either 'none', or a decoded record/tuple
properties_bin, %% either 'none', or an encoded properties binary
%% Note: at most one of properties and properties_bin can be
%% 'none' at once.
protocol, %% The protocol under which properties_bin was encoded
payload_fragments_rev %% list of binaries, in reverse order (!)
}).
-record(resource, {
virtual_host,
%% exchange, queue, ...
kind,
%% name as a binary
name
}).
%% fields described as 'transient' here are cleared when writing to
%% rabbit_durable_<thing>
-record(exchange, {
name, type, durable, auto_delete, internal, arguments, %% immutable
scratches, %% durable, explicitly updated via update_scratch/3
policy, %% durable, implicitly updated when policy changes
operator_policy, %% durable, implicitly updated when policy changes
decorators,
options = #{}}). %% transient, recalculated in store/1 (i.e. recovery)
-record(amqqueue, {
name, durable, auto_delete, exclusive_owner = none, %% immutable
arguments, %% immutable
pid, %% durable (just so we know home node)
slave_pids, sync_slave_pids, %% transient
recoverable_slaves, %% durable
policy, %% durable, implicit update as above
operator_policy, %% durable, implicit update as above
gm_pids, %% transient
decorators, %% transient, recalculated as above
state, %% durable (have we crashed?)
policy_version,
slave_pids_pending_shutdown,
vhost, %% secondary index
options = #{}}).
-record(exchange_serial, {name, next}).
%% mnesia doesn't like unary records, so we add a dummy 'value' field
-record(route, {binding, value = const}).
-record(reverse_route, {reverse_binding, value = const}).
-record(binding, {source, key, destination, args = []}).
-record(reverse_binding, {destination, key, source, args = []}).
-record(topic_trie_node, {trie_node, edge_count, binding_count}).
-record(topic_trie_edge, {trie_edge, node_id}).
-record(topic_trie_binding, {trie_binding, value = const}).
-record(trie_node, {exchange_name, node_id}).
-record(trie_edge, {exchange_name, node_id, word}).
-record(trie_binding, {exchange_name, node_id, destination, arguments}).
-record(listener, {node, protocol, host, ip_address, port, opts = []}).
-record(runtime_parameters, {key, value}).
-record(basic_message,
{exchange_name, %% The exchange where the message was received
routing_keys = [], %% Routing keys used during publish
content, %% The message content
id, %% A `rabbit_guid:gen()` generated id
is_persistent}). %% Whether the message was published as persistent
-record(delivery,
{mandatory, %% Whether the message was published as mandatory
confirm, %% Whether the message needs confirming
sender, %% The pid of the process that created the delivery
message, %% The #basic_message record
msg_seq_no, %% Msg Sequence Number from the channel publish_seqno field
flow}). %% Should flow control be used for this delivery
-record(amqp_error, {name, explanation = "", method = none}).
-record(event, {type, props, reference = undefined, timestamp}).
-record(message_properties, {expiry, needs_confirming = false, size}).
-record(plugin, {name, %% atom()
version, %% string()
description, %% string()
type, %% 'ez' or 'dir'
dependencies, %% [{atom(), string()}]
location, %% string()
%% List of supported broker version ranges,
%% e.g. ["3.5.7", "3.6.1"]
broker_version_requirements, %% [string()]
%% Proplist of supported dependency versions,
%% e.g. [{rabbitmq_management, ["3.5.7", "3.6.1"]},
%% {rabbitmq_federation, ["3.5.7", "3.6.1"]},
%% {rabbitmq_email, ["0.1.0"]}]
dependency_version_requirements, %% [{atom(), [string()]}]
extra_dependencies %% string()
}).
%% used to track connections across virtual hosts
%% so that limits can be enforced
-record(tracked_connection_per_vhost,
{vhost, connection_count}).
%% Used to track detailed information
%% about connections.
-record(tracked_connection, {
%% {Node, Name}
id,
node,
vhost,
name,
pid,
protocol,
%% network or direct
type,
%% client host
peer_host,
%% client port
peer_port,
username,
%% time of connection
connected_at
}).
%%----------------------------------------------------------------------------
-define(COPYRIGHT_MESSAGE, "Copyright (C) 2007-2018 Pivotal Software, Inc.").
-define(INFORMATION_MESSAGE, "Licensed under the MPL. See http://www.rabbitmq.com/").
-define(OTP_MINIMUM, "19.3").
-define(ERTS_MINIMUM, "8.3").
%% EMPTY_FRAME_SIZE, 8 = 1 + 2 + 4 + 1
%% - 1 byte of frame type
%% - 2 bytes of channel number
%% - 4 bytes of frame payload length
%% - 1 byte of payload trailer FRAME_END byte
%% See rabbit_binary_generator:check_empty_frame_size/0, an assertion
%% called at startup.
-define(EMPTY_FRAME_SIZE, 8).
-define(MAX_WAIT, 16#ffffffff).
-define(SUPERVISOR_WAIT,
rabbit_misc:get_env(rabbit, supervisor_shutdown_timeout, infinity)).
-define(WORKER_WAIT,
rabbit_misc:get_env(rabbit, worker_shutdown_timeout, 30000)).
-define(HIBERNATE_AFTER_MIN, 1000).
-define(DESIRED_HIBERNATE, 10000).
-define(CREDIT_DISC_BOUND, {4000, 800}).
%% When we discover that we should write some indices to disk for some
%% betas, the IO_BATCH_SIZE sets the number of betas that we must be
%% due to write indices for before we do any work at all.
-define(IO_BATCH_SIZE, 4096). %% next power-of-2 after ?CREDIT_DISC_BOUND
-define(INVALID_HEADERS_KEY, <<"x-invalid-headers">>).
-define(ROUTING_HEADERS, [<<"CC">>, <<"BCC">>]).
-define(DELETED_HEADER, <<"BCC">>).
-define(EXCHANGE_DELETE_IN_PROGRESS_COMPONENT, <<"exchange-delete-in-progress">>).
-define(CHANNEL_OPERATION_TIMEOUT, rabbit_misc:get_channel_operation_timeout()).
%% Trying to send a term across a cluster larger than 2^31 bytes will
%% cause the VM to exit with "Absurdly large distribution output data
%% buffer". So we limit the max message size to 2^31 - 10^6 bytes (1MB
%% to allow plenty of leeway for the #basic_message{} and #content{}
%% wrapping the message body).
-define(MAX_MSG_SIZE, 2147383648).
%% First number is maximum size in bytes before we start to
%% truncate. The following 4-tuple is:
%%
%% 1) Maximum size of printable lists and binaries.
%% 2) Maximum size of any structural term.
%% 3) Amount to decrease 1) every time we descend while truncating.
%% 4) Amount to decrease 2) every time we descend while truncating.
%%
%% Whole thing feeds into truncate:log_event/2.
-define(LOG_TRUNC, {100000, {2000, 100, 50, 5}}).
-define(store_proc_name(N), rabbit_misc:store_proc_name(?MODULE, N)).
%% For event audit purposes
-define(INTERNAL_USER, <<"rmq-internal">>).
-define(UNKNOWN_USER, <<"unknown">>).