rabbitmq 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +3 -0
  3. data/lib/rabbitmq.rb +2 -0
  4. data/lib/rabbitmq/ffi.rb +743 -0
  5. metadata +144 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 244f595aa2d3971af7abf7ca4cc7ef6c56c210c1
4
+ data.tar.gz: 3d416e1b3667a19c547bc11a81ca0cdf6c2530ed
5
+ SHA512:
6
+ metadata.gz: 9440df7f81db2e10d88d69816da91a1f059db6581c5d7e136b58bee98b5e516e4f8250ad87f7bbb43ff53b790915da1d44566b05998f33036b06b9e8742d9e3a
7
+ data.tar.gz: 48489bb898751dd7a433e5a7456216a08650736b6b84b9fcc67acd21eef003da45d4d60f767626458d92569394c8e9c5cc7b446f378a7a1a3c00a3d033ec3b9f
data/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # rabbitmq
2
+
3
+ A Ruby RabbitMQ client library based on FFI bindings for librabbitmq.
data/lib/rabbitmq.rb ADDED
@@ -0,0 +1,2 @@
1
+
2
+ require_relative 'rabbitmq/ffi'
@@ -0,0 +1,743 @@
1
+
2
+ require 'ffi'
3
+
4
+
5
+ module RabbitMQ
6
+ module FFI
7
+ extend ::FFI::Library
8
+
9
+ def self.available?
10
+ @available
11
+ end
12
+
13
+ begin
14
+ lib_name = 'librabbitmq'
15
+ lib_paths = ['/usr/local/lib', '/opt/local/lib', '/usr/lib64']
16
+ .map { |path| "#{path}/#{lib_name}.#{::FFI::Platform::LIBSUFFIX}" }
17
+ ffi_lib lib_paths + [lib_name]
18
+ @available = true
19
+ rescue LoadError
20
+ warn ""
21
+ warn "WARNING: #{self} is not available without librabbitmq."
22
+ warn ""
23
+ @available = false
24
+ end
25
+
26
+ if available?
27
+ opts = {
28
+ blocking: true # only necessary on MRI to deal with the GIL.
29
+ }
30
+
31
+ # The following definition is based on library version 0.5.2
32
+
33
+ attach_function :amqp_version_number, [], :uint32, **opts
34
+ attach_function :amqp_version, [], :string, **opts
35
+
36
+ Boolean = :int
37
+ MethodNumber = :uint32
38
+ Flags = :uint32
39
+ Channel = :uint16
40
+
41
+ class Bytes < ::FFI::Struct
42
+ layout :len, :size_t,
43
+ :bytes, :pointer
44
+ end
45
+
46
+ class Decimal < ::FFI::Struct
47
+ layout :decimals, :uint8,
48
+ :value, :uint32
49
+ end
50
+
51
+ class Table < ::FFI::Struct
52
+ layout :num_entries, :int,
53
+ :entries, :pointer
54
+ end
55
+
56
+ class Array < ::FFI::Struct
57
+ layout :num_entries, :int,
58
+ :entries, :pointer
59
+ end
60
+
61
+ class FieldValueValue < ::FFI::Union
62
+ layout :boolean, Boolean,
63
+ :i8, :int8,
64
+ :u8, :uint8,
65
+ :i16, :int16,
66
+ :u16, :uint16,
67
+ :i32, :int32,
68
+ :u32, :uint32,
69
+ :i64, :int64,
70
+ :u64, :uint64,
71
+ :f32, :float,
72
+ :f64, :double,
73
+ :decimal, Decimal,
74
+ :bytes, Bytes,
75
+ :table, Table,
76
+ :array, Array
77
+ end
78
+
79
+ class FieldValue < ::FFI::Struct
80
+ layout :kind, :uint8,
81
+ :value, FieldValueValue
82
+ end
83
+
84
+ class TableEntry < ::FFI::Struct
85
+ layout :key, Bytes,
86
+ :value, FieldValue
87
+ end
88
+
89
+ FieldValueKindEnum = enum [
90
+ :boolean, 't'.ord,
91
+ :i8, 'b'.ord,
92
+ :u8, 'B'.ord,
93
+ :i16, 's'.ord,
94
+ :u16, 'u'.ord,
95
+ :i32, 'I'.ord,
96
+ :u32, 'i'.ord,
97
+ :i64, 'l'.ord,
98
+ :u64, 'L'.ord,
99
+ :f32, 'f'.ord,
100
+ :f64, 'd'.ord,
101
+ :decimal, 'D'.ord,
102
+ :utf8, 'S'.ord,
103
+ :array, 'A'.ord,
104
+ :timestamp, 'T'.ord,
105
+ :table, 'F'.ord,
106
+ :void, 'V'.ord,
107
+ :bytes, 'x'.ord,
108
+ ]
109
+
110
+ class PoolBlocklist < ::FFI::Struct
111
+ layout :num_blocks, :int,
112
+ :blocklist, :pointer
113
+ end
114
+
115
+ class Pool < ::FFI::Struct
116
+ layout :pagesize, :size_t,
117
+ :pages, PoolBlocklist,
118
+ :large_blocks, PoolBlocklist,
119
+ :next_pages, :int,
120
+ :alloc_block, :pointer,
121
+ :alloc_used, :size_t
122
+ end
123
+
124
+ class Method < ::FFI::Struct
125
+ layout :id, MethodNumber,
126
+ :decoded, :pointer
127
+ end
128
+
129
+ class FramePayloadProperties < ::FFI::Struct
130
+ layout :class_id, :uint16,
131
+ :body_size, :uint64,
132
+ :decoded, :pointer,
133
+ :raw, Bytes
134
+ end
135
+
136
+ class FramePayloadProtocolHeader < ::FFI::Struct
137
+ layout :transport_high, :uint8,
138
+ :transport_low, :uint8,
139
+ :protocol_version_major, :uint8,
140
+ :protocol_version_minor, :uint8
141
+ end
142
+
143
+ class FramePayload < ::FFI::Union
144
+ layout :method, Method,
145
+ :properties, FramePayloadProperties,
146
+ :body_fragment, Bytes,
147
+ :protocol_header, FramePayloadProtocolHeader
148
+ end
149
+
150
+ class Frame < ::FFI::Union
151
+ layout :frame_type, :uint8,
152
+ :channel, Channel,
153
+ :payload, FramePayload
154
+ end
155
+
156
+ ResponseTypeEnum = enum [
157
+ :none, 0,
158
+ :normal,
159
+ :library_exception,
160
+ :server_exception,
161
+ ]
162
+
163
+ class RpcReply < ::FFI::Struct
164
+ layout :reply_type, ResponseTypeEnum,
165
+ :reply, Method,
166
+ :library_error, :int
167
+ end
168
+
169
+ SaslMethodEnum = enum [
170
+ :plain, 0,
171
+ ]
172
+
173
+ ConnectionState = :pointer
174
+
175
+ StatusEnum = enum [
176
+ :ok, 0x0,
177
+ :no_memory, -0x0001,
178
+ :bad_amqp_data, -0x0002,
179
+ :unknown_class, -0x0003,
180
+ :unknown_method, -0x0004,
181
+ :hostname_resolution_failed, -0x0005,
182
+ :incompatible_amqp_version, -0x0006,
183
+ :connection_closed, -0x0007,
184
+ :bad_url, -0x0008,
185
+ :socket_error, -0x0009,
186
+ :invalid_parameter, -0x000A,
187
+ :table_too_big, -0x000B,
188
+ :wrong_method, -0x000C,
189
+ :timeout, -0x000D,
190
+ :timer_failure, -0x000E,
191
+ :heartbeat_timeout, -0x000F,
192
+ :unexpected_state, -0x0010,
193
+ :tcp_error, -0x0100,
194
+ :tcp_socketlib_init_error, -0x0101,
195
+ :ssl_error, -0x0200,
196
+ :ssl_hostname_verify_failed, -0x0201,
197
+ :ssl_peer_verify_failed, -0x0202,
198
+ :ssl_connection_failed, -0x0203,
199
+ ]
200
+
201
+ DeliveryModeEnum = enum [
202
+ :nonpersistent, 1,
203
+ :persistent, 2,
204
+ ]
205
+
206
+ attach_function :amqp_constant_name, [:int], :string, **opts
207
+ attach_function :amqp_constant_is_hard_error, [:int], Boolean, **opts
208
+
209
+ attach_function :amqp_method_name, [MethodNumber], :string, **opts
210
+ attach_function :amqp_method_has_content, [MethodNumber], Boolean, **opts
211
+ attach_function :amqp_decode_method, [MethodNumber, :pointer, Bytes, :pointer], :int, **opts
212
+ attach_function :amqp_decode_properties, [:uint16, :pointer, Bytes, :pointer], :int, **opts
213
+ attach_function :amqp_encode_method, [MethodNumber, :pointer, Bytes], :int, **opts
214
+ attach_function :amqp_encode_properties, [:uint16, :pointer, Bytes], :int, **opts
215
+
216
+ class ConnectionStart < ::FFI::Struct
217
+ layout :version_major, :uint8,
218
+ :version_minor, :uint8,
219
+ :server_properties, Table,
220
+ :mechanisms, Bytes,
221
+ :locales, Bytes
222
+ end
223
+
224
+ class ConnectionStartOk < ::FFI::Struct
225
+ layout :client_properties, Table,
226
+ :mechanism, Bytes,
227
+ :response, Bytes,
228
+ :locale, Bytes
229
+ end
230
+
231
+ class ConnectionSecure < ::FFI::Struct
232
+ layout :challenge, Bytes
233
+ end
234
+
235
+ class ConnectionSecureOk < ::FFI::Struct
236
+ layout :response, Bytes
237
+ end
238
+
239
+ class ConnectionTune < ::FFI::Struct
240
+ layout :channel_max, :uint16,
241
+ :frame_max, :uint32,
242
+ :heartbeat, :uint16
243
+ end
244
+
245
+ class ConnectionTuneOk < ::FFI::Struct
246
+ layout :channel_max, :uint16,
247
+ :frame_max, :uint32,
248
+ :heartbeat, :uint16
249
+ end
250
+
251
+ class ConnectionOpen < ::FFI::Struct
252
+ layout :virtual_host, Bytes,
253
+ :capabilities, Bytes,
254
+ :insist, Boolean
255
+ end
256
+
257
+ class ConnectionOpenOk < ::FFI::Struct
258
+ layout :known_hosts, Bytes
259
+ end
260
+
261
+ class ConnectionClose < ::FFI::Struct
262
+ layout :reply_code, :uint16,
263
+ :reply_text, Bytes,
264
+ :class_id, :uint16,
265
+ :method_id, :uint16
266
+ end
267
+
268
+ class ConnectionCloseOk < ::FFI::Struct
269
+ layout :dummy, :char
270
+ end
271
+
272
+ class ConnectionBlocked < ::FFI::Struct
273
+ layout :reason, Bytes
274
+ end
275
+
276
+ class ConnectionUnblocked < ::FFI::Struct
277
+ layout :dummy, :char
278
+ end
279
+
280
+ class ChannelOpen < ::FFI::Struct
281
+ layout :out_of_band, Bytes
282
+ end
283
+
284
+ class ChannelOpenOk < ::FFI::Struct
285
+ layout :channel_id, Bytes
286
+ end
287
+
288
+ class ChannelFlow < ::FFI::Struct
289
+ layout :active, Boolean
290
+ end
291
+
292
+ class ChannelFlowOk < ::FFI::Struct
293
+ layout :active, Boolean
294
+ end
295
+
296
+ class ChannelClose < ::FFI::Struct
297
+ layout :reply_code, :uint16,
298
+ :reply_text, Bytes,
299
+ :class_id, :uint16,
300
+ :method_i, :uint16
301
+ end
302
+
303
+ class ChannelCloseOk < ::FFI::Struct
304
+ layout :dummy, :char
305
+ end
306
+
307
+ class AccessRequest < ::FFI::Struct
308
+ layout :realm, Bytes,
309
+ :exclusive, Boolean,
310
+ :passive, Boolean,
311
+ :active, Boolean,
312
+ :write, Boolean,
313
+ :read, Boolean
314
+ end
315
+
316
+ class AccessRequestOk < ::FFI::Struct
317
+ layout :ticket, :uint16
318
+ end
319
+
320
+ class ExchangeDeclare < ::FFI::Struct
321
+ layout :ticket, :uint16,
322
+ :exchange, Bytes,
323
+ :type, Bytes,
324
+ :passive, Boolean,
325
+ :durable, Boolean,
326
+ :auto_delete, Boolean,
327
+ :internal, Boolean,
328
+ :nowait, Boolean,
329
+ :arguments, Bytes
330
+ end
331
+
332
+ class ExchangeDeclareOk < ::FFI::Struct
333
+ layout :dummy, :char
334
+ end
335
+
336
+ class ExchangeDelete < ::FFI::Struct
337
+ layout :ticket, :uint16,
338
+ :exchange, Bytes,
339
+ :if_unused, Boolean,
340
+ :nowait, Boolean
341
+ end
342
+
343
+ class ExchangeDeleteOk < ::FFI::Struct
344
+ layout :dummy, :char
345
+ end
346
+
347
+ class ExchangeBind < ::FFI::Struct
348
+ layout :ticket, :uint16,
349
+ :destination, Bytes,
350
+ :source, Bytes,
351
+ :routing_key, Bytes,
352
+ :nowait, Boolean,
353
+ :arguments, Bytes
354
+ end
355
+
356
+ class ExchangeBindOk < ::FFI::Struct
357
+ layout :dummy, :char
358
+ end
359
+
360
+ class ExchangeUnbind < ::FFI::Struct
361
+ layout :ticket, :uint16,
362
+ :destination, Bytes,
363
+ :source, Bytes,
364
+ :routing_key, Bytes,
365
+ :nowait, Boolean,
366
+ :arguments, Bytes
367
+ end
368
+
369
+ class ExchangeUnbindOk < ::FFI::Struct
370
+ layout :dummy, :char
371
+ end
372
+
373
+ class QueueDeclare < ::FFI::Struct
374
+ layout :ticket, :uint16,
375
+ :queue, Bytes,
376
+ :passive, Boolean,
377
+ :durable, Boolean,
378
+ :exclusive, Boolean,
379
+ :auto_delete, Boolean,
380
+ :nowait, Boolean,
381
+ :arguments, Bytes
382
+ end
383
+
384
+ class QueueDeclareOk < ::FFI::Struct
385
+ layout :queue, Bytes,
386
+ :message_count, :uint32,
387
+ :consumer_count, :uint32
388
+ end
389
+
390
+ class QueueBind < ::FFI::Struct
391
+ layout :ticket, :uint16,
392
+ :queue, Bytes,
393
+ :exchange, Bytes,
394
+ :routing_key, Bytes,
395
+ :nowait, Boolean,
396
+ :arguments, Bytes
397
+ end
398
+
399
+ class QueueBindOk < ::FFI::Struct
400
+ layout :dummy, :char
401
+ end
402
+
403
+ class QueuePurge < ::FFI::Struct
404
+ layout :ticket, :uint16,
405
+ :queue, Bytes,
406
+ :nowait, Boolean
407
+ end
408
+
409
+ class QueuePurgeOk < ::FFI::Struct
410
+ layout :message_count, :uint32
411
+ end
412
+
413
+ class QueueDelete < ::FFI::Struct
414
+ layout :ticket, :uint16,
415
+ :queue, Bytes,
416
+ :if_unused, Boolean,
417
+ :if_empty, Boolean,
418
+ :nowait, Boolean
419
+ end
420
+
421
+ class QueueDeleteOk < ::FFI::Struct
422
+ layout :message_count, :uint32
423
+ end
424
+
425
+ class QueueUnbind < ::FFI::Struct
426
+ layout :ticket, :uint16,
427
+ :queue, Bytes,
428
+ :exchange, Bytes,
429
+ :routing_key, Bytes,
430
+ :arguments, Bytes
431
+ end
432
+
433
+ class QueueUnbindOk < ::FFI::Struct
434
+ layout :dummy, :char
435
+ end
436
+
437
+ class BasicQos < ::FFI::Struct
438
+ layout :prefetch_size, :uint32,
439
+ :prefetch_count, :uint16,
440
+ :global, Boolean
441
+ end
442
+
443
+ class BasicQosOk < ::FFI::Struct
444
+ layout :dummy, :char
445
+ end
446
+
447
+ class BasicConsume < ::FFI::Struct
448
+ layout :ticket, :uint16,
449
+ :queue, Bytes,
450
+ :consumer_tag, Bytes,
451
+ :no_local, Boolean,
452
+ :no_ack, Boolean,
453
+ :exclusive, Boolean,
454
+ :nowait, Boolean,
455
+ :arguments, Bytes
456
+ end
457
+
458
+ class BasicConsumeOk < ::FFI::Struct
459
+ layout :consumer_tag, Bytes
460
+ end
461
+
462
+ class BasicCancel < ::FFI::Struct
463
+ layout :consumer_tag, Bytes,
464
+ :nowait, Boolean
465
+ end
466
+
467
+ class BasicCancelOk < ::FFI::Struct
468
+ layout :consumer_tag, Bytes
469
+ end
470
+
471
+ class BasicPublish < ::FFI::Struct
472
+ layout :ticket, :uint16,
473
+ :exchange, Bytes,
474
+ :routing_key, Bytes,
475
+ :mandatory, Boolean,
476
+ :immediate, Boolean
477
+ end
478
+
479
+ class BasicReturn < ::FFI::Struct
480
+ layout :reply_code, :uint16,
481
+ :reply_text, Bytes,
482
+ :exchange, Bytes,
483
+ :routing_key, Bytes
484
+ end
485
+
486
+ class BasicDeliver < ::FFI::Struct
487
+ layout :consumer_tag, Bytes,
488
+ :delivery_tag, :uint64,
489
+ :redelivered, Boolean,
490
+ :exchange, Bytes,
491
+ :routing_key, Bytes
492
+ end
493
+
494
+ class BasicGet < ::FFI::Struct
495
+ layout :ticket, :uint16,
496
+ :queue, Bytes,
497
+ :no_ack, Boolean
498
+ end
499
+
500
+ class BasicGetOk < ::FFI::Struct
501
+ layout :delivery_tag, :uint64,
502
+ :redelivered, Boolean,
503
+ :exchange, Bytes,
504
+ :routing_key, Bytes,
505
+ :message_count, :uint32
506
+ end
507
+
508
+ class BasicGetEmpty < ::FFI::Struct
509
+ layout :cluster_id, Bytes
510
+ end
511
+
512
+ class BasicAck < ::FFI::Struct
513
+ layout :delivery_tag, :uint64,
514
+ :multiple, Boolean
515
+ end
516
+
517
+ class BasicReject < ::FFI::Struct
518
+ layout :delivery_tag, :uint64,
519
+ :requeue, Boolean
520
+ end
521
+
522
+ class BasicRecoverAsync < ::FFI::Struct
523
+ layout :requeue, Boolean
524
+ end
525
+
526
+ class BasicRecover < ::FFI::Struct
527
+ layout :requeue, Boolean
528
+ end
529
+
530
+ class BasicRecoverOk < ::FFI::Struct
531
+ layout :dummy, :char
532
+ end
533
+
534
+ class BasicNack < ::FFI::Struct
535
+ layout :delivery_tag, :uint64,
536
+ :multiple, Boolean,
537
+ :requeue, Boolean
538
+ end
539
+
540
+ class TxSelect < ::FFI::Struct
541
+ layout :dummy, :char
542
+ end
543
+
544
+ class TxSelectOk < ::FFI::Struct
545
+ layout :dummy, :char
546
+ end
547
+
548
+ class TxCommit < ::FFI::Struct
549
+ layout :dummy, :char
550
+ end
551
+
552
+ class TxCommitOk < ::FFI::Struct
553
+ layout :dummy, :char
554
+ end
555
+
556
+ class TxRollback < ::FFI::Struct
557
+ layout :dummy, :char
558
+ end
559
+
560
+ class TxRollbackOk < ::FFI::Struct
561
+ layout :dummy, :char
562
+ end
563
+
564
+ class ConfirmSelect < ::FFI::Struct
565
+ layout :nowait, Boolean
566
+ end
567
+
568
+ class ConfirmSelectOk < ::FFI::Struct
569
+ layout :dummy, :char
570
+ end
571
+
572
+ class ConnectionProperties < ::FFI::Struct
573
+ layout :flags, Flags,
574
+ :dummy, :char
575
+ end
576
+
577
+ class ChannelProperties < ::FFI::Struct
578
+ layout :flags, Flags,
579
+ :dummy, :char
580
+ end
581
+
582
+ class AccessProperties < ::FFI::Struct
583
+ layout :flags, Flags,
584
+ :dummy, :char
585
+ end
586
+
587
+ class ExchangeProperties < ::FFI::Struct
588
+ layout :flags, Flags,
589
+ :dummy, :char
590
+ end
591
+
592
+ class QueueProperties < ::FFI::Struct
593
+ layout :flags, Flags,
594
+ :dummy, :char
595
+ end
596
+
597
+ class TxProperties < ::FFI::Struct
598
+ layout :flags, Flags,
599
+ :dummy, :char
600
+ end
601
+
602
+ class ExchangeProperties < ::FFI::Struct
603
+ layout :flags, Flags,
604
+ :dummy, :char
605
+ end
606
+
607
+ class BasicProperties < ::FFI::Struct
608
+ layout :_flags, Flags,
609
+ :content_type, Bytes,
610
+ :content_encoding, Bytes,
611
+ :headers, Table,
612
+ :delivery_mode, :uint8,
613
+ :priority, :uint8,
614
+ :correlation_id, Bytes,
615
+ :reply_to, Bytes,
616
+ :expiration, Bytes,
617
+ :message_id, Bytes,
618
+ :timestamp, :uint64,
619
+ :type, Bytes,
620
+ :user_id, Bytes,
621
+ :app_id, Bytes,
622
+ :cluster_id, Bytes
623
+ end
624
+
625
+ attach_function :amqp_channel_open, [ConnectionState, Channel], :pointer, **opts
626
+ attach_function :amqp_channel_flow, [ConnectionState, Channel, Boolean], :pointer, **opts
627
+ attach_function :amqp_exchange_declare, [ConnectionState, Channel, Bytes, Bytes, Boolean, Boolean, Table], :pointer, **opts
628
+ attach_function :amqp_exchange_delete, [ConnectionState, Channel, Bytes, Boolean], :pointer, **opts
629
+ attach_function :amqp_exchange_bind, [ConnectionState, Channel, Bytes, Bytes, Bytes, Table], :pointer, **opts
630
+ attach_function :amqp_exchange_unbind, [ConnectionState, Channel, Bytes, Bytes, Bytes, Table], :pointer, **opts
631
+ attach_function :amqp_queue_declare, [ConnectionState, Channel, Bytes, Boolean, Boolean, Boolean, Boolean, Table], :pointer, **opts
632
+ attach_function :amqp_queue_bind, [ConnectionState, Channel, Bytes, Bytes, Bytes, Table], :pointer, **opts
633
+ attach_function :amqp_queue_purge, [ConnectionState, Channel, Bytes], :pointer, **opts
634
+ attach_function :amqp_queue_delete, [ConnectionState, Channel, Bytes, Boolean, Boolean], :pointer, **opts
635
+ attach_function :amqp_queue_unbind, [ConnectionState, Channel, Bytes, Bytes, Bytes, Table], :pointer, **opts
636
+ attach_function :amqp_basic_qos, [ConnectionState, Channel, :uint32, :uint16, Boolean], :pointer, **opts
637
+ attach_function :amqp_basic_consume, [ConnectionState, Channel, Bytes, Bytes, Boolean, Boolean, Boolean, Table], :pointer, **opts
638
+ attach_function :amqp_basic_cancel, [ConnectionState, Channel, Bytes], :pointer, **opts
639
+ attach_function :amqp_basic_recover, [ConnectionState, Channel, Boolean], :pointer, **opts
640
+ attach_function :amqp_tx_select, [ConnectionState, Channel], :pointer, **opts
641
+ attach_function :amqp_tx_commit, [ConnectionState, Channel], :pointer, **opts
642
+ attach_function :amqp_tx_rollback, [ConnectionState, Channel], :pointer, **opts
643
+ attach_function :amqp_confirm_select, [ConnectionState, Channel], :pointer, **opts
644
+
645
+ attach_function :init_amqp_pool, [:pointer, :size_t], :void, **opts
646
+ attach_function :recycle_amqp_pool, [:pointer], :void, **opts
647
+ attach_function :empty_amqp_pool, [:pointer], :void, **opts
648
+ attach_function :amqp_pool_alloc, [:pointer, :size_t], :pointer, **opts
649
+ attach_function :amqp_pool_alloc_bytes, [:pointer, :size_t, :pointer], :void, **opts
650
+
651
+ attach_function :amqp_cstring_bytes, [:string], Bytes, **opts
652
+ attach_function :amqp_bytes_malloc_dup, [Bytes], Bytes, **opts
653
+ attach_function :amqp_bytes_malloc, [:size_t], Bytes, **opts
654
+ attach_function :amqp_bytes_free, [Bytes], :void, **opts
655
+
656
+ attach_function :amqp_new_connection, [], ConnectionState, **opts
657
+ attach_function :amqp_get_sockfd, [ConnectionState], :int, **opts
658
+ attach_function :amqp_set_sockfd, [ConnectionState, :int], :void, **opts
659
+ attach_function :amqp_tune_connection, [ConnectionState, :int, :int, :int], :int, **opts
660
+ attach_function :amqp_get_channel_max, [ConnectionState], :int, **opts
661
+ attach_function :amqp_destroy_connection, [ConnectionState], :int, **opts
662
+
663
+ attach_function :amqp_handle_input, [ConnectionState, Bytes, :pointer], :int, **opts
664
+ attach_function :amqp_release_buffers_ok, [ConnectionState], Boolean, **opts
665
+ attach_function :amqp_release_buffers, [ConnectionState], :void, **opts
666
+ attach_function :amqp_maybe_release_buffers, [ConnectionState], :void, **opts
667
+ attach_function :amqp_maybe_release_buffers_on_channel, [ConnectionState, Channel], :void, **opts
668
+ attach_function :amqp_send_frame, [ConnectionState, :pointer], :int, **opts
669
+
670
+ attach_function :amqp_table_entry_cmp, [:pointer, :pointer], :int, **opts
671
+ attach_function :amqp_open_socket, [:string, :int], :int, **opts
672
+
673
+ attach_function :amqp_send_header, [ConnectionState], :int, **opts
674
+ attach_function :amqp_frames_enqueued, [ConnectionState], Boolean, **opts
675
+ attach_function :amqp_simple_wait_frame, [ConnectionState, :pointer], :int, **opts
676
+ attach_function :amqp_simple_wait_frame_noblock, [ConnectionState, :pointer, :pointer], :int, **opts
677
+ attach_function :amqp_simple_wait_method, [ConnectionState, Channel, MethodNumber, :pointer], :int, **opts
678
+ attach_function :amqp_send_method, [ConnectionState, Channel, MethodNumber, :pointer], :int, **opts
679
+
680
+ attach_function :amqp_simple_rpc, [ConnectionState, Channel, MethodNumber, :pointer, :pointer], RpcReply, **opts
681
+ attach_function :amqp_simple_rpc_decoded, [ConnectionState, Channel, MethodNumber, MethodNumber, :pointer], :pointer, **opts
682
+ attach_function :amqp_get_rpc_reply, [ConnectionState], RpcReply, **opts
683
+ attach_function :amqp_login, [ConnectionState, :string, :int, :int, :int, SaslMethodEnum], RpcReply, **opts
684
+ attach_function :amqp_login_with_properties, [ConnectionState, :string, :int, :int, :int, :pointer, SaslMethodEnum], RpcReply, **opts
685
+ attach_function :amqp_channel_close, [ConnectionState, Channel, :int], RpcReply, **opts
686
+ attach_function :amqp_connection_close, [ConnectionState, :int], RpcReply, **opts
687
+
688
+ attach_function :amqp_basic_publish, [ConnectionState, Channel, Bytes, Bytes, Boolean, Boolean, :pointer, Bytes], :int, **opts
689
+ attach_function :amqp_basic_ack, [ConnectionState, Channel, :uint64, Boolean], :int, **opts
690
+ attach_function :amqp_basic_get, [ConnectionState, Channel, Bytes, Boolean], :int, **opts
691
+ attach_function :amqp_basic_reject, [ConnectionState, Channel, :uint64, Boolean], :int, **opts
692
+ attach_function :amqp_basic_nack, [ConnectionState, Channel, :uint64, Boolean, Boolean], :int, **opts
693
+
694
+ attach_function :amqp_data_in_buffer, [ConnectionState], Boolean, **opts
695
+
696
+ attach_function :amqp_error_string, [:int], :string, **opts
697
+ attach_function :amqp_error_string2, [:int], :string, **opts
698
+
699
+ attach_function :amqp_decode_table, [Bytes, :pointer, :pointer, :pointer], :int, **opts
700
+ attach_function :amqp_encode_table, [Bytes, :pointer, :pointer], :int, **opts
701
+ attach_function :amqp_table_clone, [:pointer, :pointer, :pointer], :int, **opts
702
+
703
+ class Message < ::FFI::Struct
704
+ layout :properties, BasicProperties,
705
+ :body, Bytes,
706
+ :pool, Pool
707
+ end
708
+
709
+ attach_function :amqp_read_message, [ConnectionState, Channel, :pointer, :int], RpcReply, **opts
710
+ attach_function :amqp_destroy_message, [:pointer], :void, **opts
711
+
712
+ class Envelope < ::FFI::Struct
713
+ layout :channel, Channel,
714
+ :consumer_tag, Bytes,
715
+ :delivery_tag, :uint64,
716
+ :redelivered, Boolean,
717
+ :exchange, Bytes,
718
+ :routing_key, Bytes,
719
+ :message, Message
720
+ end
721
+
722
+ attach_function :amqp_consume_message, [ConnectionState, :pointer, :pointer, :int], RpcReply, **opts
723
+ attach_function :amqp_destroy_envelope, [:pointer], :void, **opts
724
+
725
+ class ConnectionInfo < ::FFI::Struct
726
+ layout :user, :string,
727
+ :password, :string,
728
+ :host, :string,
729
+ :vhost, :string,
730
+ :port, :int,
731
+ :ssl, Boolean
732
+ end
733
+
734
+ attach_function :amqp_default_connection_info, [:pointer], :void, **opts
735
+ attach_function :amqp_parse_url, [:string, :pointer], :int, **opts
736
+ attach_function :amqp_socket_open, [:pointer, :string, :int], :int, **opts
737
+ attach_function :amqp_socket_open_noblock, [:pointer, :string, :int, :pointer], :int, **opts
738
+ attach_function :amqp_socket_get_sockfd, [:pointer], :int, **opts
739
+ attach_function :amqp_get_socket, [ConnectionState], :pointer, **opts
740
+ attach_function :amqp_get_server_properties, [ConnectionState], Table, **opts
741
+ end
742
+ end
743
+ end
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rabbitmq
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Joe McIlvain
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ffi
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.9'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.9'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-its
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: fivemat
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.3'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.3'
111
+ description: A Ruby RabbitMQ client library based on FFI bindings for librabbitmq.
112
+ email: joe.eli.mac@gmail.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - README.md
118
+ - lib/rabbitmq.rb
119
+ - lib/rabbitmq/ffi.rb
120
+ homepage: https://github.com/jemc/rabbitmq/
121
+ licenses:
122
+ - MIT
123
+ metadata: {}
124
+ post_install_message:
125
+ rdoc_options: []
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ requirements: []
139
+ rubyforge_project:
140
+ rubygems_version: 2.2.2
141
+ signing_key:
142
+ specification_version: 4
143
+ summary: rabbitmq
144
+ test_files: []