Debian Codegraph @

c/include/proton/cproton.i

raw
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 typedef unsigned int size_t;
20 typedef signed int ssize_t;
21 typedef unsigned char uint8_t;
22 typedef signed char int8_t;
23 typedef unsigned short uint16_t;
24 typedef signed short int16_t;
25 typedef unsigned long int uint32_t;
26 typedef long int int32_t;
27 typedef unsigned long long int uint64_t;
28 typedef long long int int64_t;
29 #if UINTPTR_SIZE==8
30 typedef unsigned long long int uintptr_t;
31 #else
32 typedef unsigned long int uintptr_t;
33 #endif
34
35 /* Parse these interface header files to generate APIs for script languages */
36
37 %include "proton/import_export.h"
38
39 %ignore _PROTON_VERSION_H;
40 %ignore PN_INSTALL_PREFIX;
41 %include "proton/version.h"
42
43 /* We cannot safely just wrap pn_bytes_t but each language binding must have a typemap for it - presumably to a string type */
44 %ignore pn_bytes_t;
45 %ignore pn_rwbytes_t;
46
47 /* pn_event_batch_t is not used directly by bindings */
48 %ignore pn_event_batch_t;
49
50 /* There is no need to wrap pn_class_t aa it is an internal implementation detail and cannot be used outside the library */
51 %ignore pn_class_t;
52
53 /* Ignore C APIs related to pn_atom_t - they can all be achieved with pn_data_t */
54 %ignore pn_atom_t;
55 %ignore pn_atom_t_u; /* Seem to need this even though its nested in pn_atom_t */
56 %ignore pn_data_get_atom;
57 %ignore pn_data_put_atom;
58
59 %ignore pn_delivery_tag_t;
60 %ignore pn_decimal128_t;
61 %ignore pn_uuid_t;
62
63 %include "proton/types.h"
64 %ignore pn_string_vformat;
65 %ignore pn_string_vaddf;
66 %immutable PN_OBJECT;
67 %immutable PN_VOID;
68 %immutable PN_WEAKREF;
69
70 %include "proton/object.h"
71
72 %ignore pn_error_format;
73 %ignore pn_error_vformat;
74 %ignore pn_condition_format;
75 %ignore pn_condition_vformat;
76
77 /* checks that ensure only allowed values are supplied or returned */
78 %aggregate_check(int, check_error,
79 PN_EOS, PN_ERR, PN_OVERFLOW, PN_UNDERFLOW,
80 PN_STATE_ERR, PN_ARG_ERR, PN_TIMEOUT);
81
82 %aggregate_check(int, check_state,
83 PN_LOCAL_UNINIT, PN_LOCAL_ACTIVE, PN_LOCAL_CLOSED,
84 PN_REMOTE_UNINIT, PN_REMOTE_ACTIVE, PN_REMOTE_CLOSED);
85
86 %aggregate_check(int, check_disposition, 0,
87 PN_RECEIVED, PN_ACCEPTED, PN_REJECTED,
88 PN_RELEASED, PN_MODIFIED);
89
90 %aggregate_check(int, check_trace,
91 PN_TRACE_OFF, PN_TRACE_RAW, PN_TRACE_FRM, PN_TRACE_DRV);
92
93 %aggregate_check(int, check_sasl_outcome,
94 PN_SASL_NONE, PN_SASL_OK, PN_SASL_AUTH,
95 PN_SASL_SYS, PN_SASL_PERM, PN_SASL_TEMP);
96
97
98 %contract pn_code(int code)
99 {
100 require:
101 check_error(code);
102 }
103
104 %contract pn_error()
105 {
106 ensure:
107 pn_error != NULL;
108 }
109
110 %contract pn_error_free(pn_error_t *error)
111 {
112 require:
113 error != NULL;
114 }
115
116 %contract pn_error_clear(pn_error_t *error)
117 {
118 require:
119 error != NULL;
120 }
121
122 %contract pn_error_set(pn_error_t *error, int code, const char *text)
123 {
124 require:
125 error != NULL;
126 }
127
128 %contract pn_error_vformat(pn_error_t *error, int code, const char *fmt, va_list ap)
129 {
130 require:
131 error != NULL;
132 }
133
134 %contract pn_error_format(pn_error_t *error, int code, const char *fmt, ...)
135 {
136 require:
137 error != NULL;
138 }
139
140 %contract pn_error_code(pn_error_t *error)
141 {
142 require:
143 error != NULL;
144 }
145
146 %contract pn_error_text(pn_error_t *error)
147 {
148 require:
149 error != NULL;
150 }
151
152 %include "proton/error.h"
153
154 %contract pn_connection(void)
155 {
156 ensure:
157 pn_connection != NULL;
158 }
159
160 %contract pn_connection_state(pn_connection_t *connection)
161 {
162 require:
163 connection != NULL;
164 }
165
166 %contract pn_connection_error(pn_connection_t *connection)
167 {
168 require:
169 connection != NULL;
170 }
171
172 %contract pn_connection_get_container(pn_connection_t *connection)
173 {
174 require:
175 connection != NULL;
176 }
177
178 %contract pn_connection_set_container(pn_connection_t *connection, const char *container)
179 {
180 require:
181 connection != NULL;
182 }
183
184 %contract pn_connection_get_hostname(pn_connection_t *connection)
185 {
186 require:
187 connection != NULL;
188 }
189
190 %contract pn_connection_set_hostname(pn_connection_t *connection, const char *hostname)
191 {
192 require:
193 connection != NULL;
194 }
195
196 %contract pn_connection_remote_container(pn_connection_t *connection)
197 {
198 require:
199 connection != NULL;
200 }
201
202 %contract pn_connection_remote_hostname(pn_connection_t *connection)
203 {
204 require:
205 connection != NULL;
206 }
207
208 %contract pn_work_head(pn_connection_t *connection)
209 {
210 require:
211 connection != NULL;
212 }
213
214 %contract pn_work_next(pn_delivery_t *delivery)
215 {
216 require:
217 delivery != NULL;
218 }
219
220 %contract pn_session(pn_connection_t *connection)
221 {
222 require:
223 connection != NULL;
224 }
225
226 %contract pn_transport(pn_connection_t *connection)
227 {
228 require:
229 connection != NULL;
230 ensure:
231 pn_transport != NULL;
232 }
233
234 %contract pn_session_head(pn_connection_t *connection, pn_state_t state)
235 {
236 require:
237 connection != NULL;
238 }
239
240 %contract pn_session_next(pn_session_t *session, pn_state_t state)
241 {
242 require:
243 session != NULL;
244 }
245
246 %contract pn_link_head(pn_connection_t *connection, pn_state_t state)
247 {
248 require:
249 connection != NULL;
250 }
251
252 %contract pn_link_next(pn_link_t *link, pn_state_t state)
253 {
254 require:
255 link != NULL;
256 }
257
258 %contract pn_connection_open(pn_connection_t *connection)
259 {
260 require:
261 connection != NULL;
262 }
263
264 %contract pn_connection_close(pn_connection_t *connection)
265 {
266 require:
267 connection != NULL;
268 }
269
270 %contract pn_connection_free(pn_connection_t *connection)
271 {
272 require:
273 connection != NULL;
274 }
275
276 %contract pn_transport_error(pn_transport_t *transport)
277 {
278 require:
279 transport != NULL;
280 }
281
282 %contract pn_transport_input(pn_transport_t *transport, char *bytes, size_t available)
283 {
284 require:
285 transport != NULL;
286 }
287
288 %contract pn_transport_output(pn_transport_t *transport, char *bytes, size_t size)
289 {
290 require:
291 transport != NULL;
292 }
293
294 #%contract pn_transport_tick(pn_transport_t *transport, pn_timestamp_t now)
295 #{
296 # # this method currently always returns 0
297 #}
298
299 %contract pn_transport_trace(pn_transport_t *transport, pn_trace_t trace)
300 {
301 require:
302 transport != NULL;
303 }
304
305 %contract pn_transport_free(pn_transport_t *transport)
306 {
307 require:
308 transport != NULL;
309 }
310
311 %contract pn_session_state(pn_session_t *session)
312 {
313 require:
314 session != NULL;
315 }
316
317 %contract pn_session_error(pn_session_t *session)
318 {
319 require:
320 session != NULL;
321 }
322
323 %contract pn_sender(pn_session_t *session, const char *name)
324 {
325 require:
326 session != NULL;
327 ensure:
328 pn_sender != NULL;
329 }
330
331 %contract pn_receiver(pn_session_t *session, const char *name)
332 {
333 require:
334 session != NULL;
335 ensure:
336 pn_receiver != NULL;
337 }
338
339 %contract pn_session_connection(pn_session_t *session)
340 {
341 require:
342 session != NULL;
343 ensure:
344 pn_session_connection != NULL;
345 }
346
347 %contract pn_session_open(pn_session_t *session)
348 {
349 require:
350 session != NULL;
351 }
352
353 %contract pn_session_close(pn_session_t *session)
354 {
355 require:
356 session != NULL;
357 }
358
359 %contract pn_session_free(pn_session_t *session)
360 {
361 require:
362 session != NULL;
363 }
364
365 %contract pn_link_name(pn_link_t *link)
366 {
367 require:
368 link != NULL;
369 }
370
371 %contract pn_link_is_sender(pn_link_t *link)
372 {
373 require:
374 link != NULL;
375 }
376
377 %contract pn_link_is_receiver(pn_link_t *link)
378 {
379 require:
380 link != NULL;
381 }
382
383 %contract pn_link_state(pn_link_t *link)
384 {
385 require:
386 link != NULL;
387 }
388
389 %contract pn_link_error(pn_link_t *link)
390 {
391 require:
392 link != NULL;
393 }
394
395 %contract pn_link_session(pn_link_t *link)
396 {
397 require:
398 link != NULL;
399 ensure:
400 pn_link_session != NULL;
401 }
402
403 %contract pn_link_get_target(pn_link_t *link)
404 {
405 require:
406 link != NULL;
407 }
408
409 %contract pn_link_get_source(pn_link_t *link)
410 {
411 require:
412 link != NULL;
413 }
414
415 %contract pn_link_set_source(pn_link_t *link, const char *source)
416 {
417 require:
418 link != NULL;
419 }
420
421 %contract pn_link_set_target(pn_link_t *link, const char *target)
422 {
423 require:
424 link != NULL;
425 }
426
427 %contract pn_link_remote_source(pn_link_t *link)
428 {
429 require:
430 link != NULL;
431 }
432
433 %contract pn_link_remote_target(pn_link_t *link)
434 {
435 require:
436 link != NULL;
437 }
438
439 %contract pn_delivery(pn_link_t *link, pn_delivery_tag_t tag)
440 {
441 require:
442 link != NULL;
443 ensure:
444 pn_delivery != NULL;
445 }
446
447 %contract pn_link_current(pn_link_t *link)
448 {
449 require:
450 link != NULL;
451 }
452
453 %contract pn_link_advance(pn_link_t *link)
454 {
455 require:
456 link != NULL;
457 }
458
459 %contract pn_link_credit(pn_link_t *link)
460 {
461 require:
462 link != NULL;
463 }
464
465 %contract pn_link_queued(pn_link_t *link)
466 {
467 require:
468 link != NULL;
469 }
470
471 %contract pn_link_unsettled(pn_link_t *link)
472 {
473 require:
474 link != NULL;
475 }
476
477 %contract pn_unsettled_head(pn_link_t *link)
478 {
479 require:
480 link != NULL;
481 }
482
483 %contract pn_unsettled_next(pn_delivery_t *delivery)
484 {
485 require:
486 delivery != NULL;
487 }
488
489 %contract pn_link_open(pn_link_t *sender)
490 {
491 require:
492 sender != NULL;
493 }
494
495 %contract pn_link_close(pn_link_t *sender)
496 {
497 require:
498 sender != NULL;
499 }
500
501 %contract pn_link_free(pn_link_t *sender)
502 {
503 require:
504 sender != NULL;
505 }
506
507 %contract pn_link_send(pn_link_t *sender, const char *bytes, size_t n)
508 {
509 require:
510 sender != NULL;
511 }
512
513 %contract pn_link_drained(pn_link_t *sender)
514 {
515 require:
516 sender != NULL;
517 }
518
519 %contract pn_link_flow(pn_link_t *receiver, int credit)
520 {
521 require:
522 receiver != NULL;
523 }
524
525 %contract pn_link_drain(pn_link_t *receiver, int credit)
526 {
527 require:
528 receiver != NULL;
529 }
530
531 %contract pn_link_recv(pn_link_t *receiver, char *bytes, size_t n)
532 {
533 require:
534 receiver != NULL;
535 }
536
537 %contract pn_delivery_tag(pn_delivery_t *delivery)
538 {
539 require:
540 delivery != NULL;
541 }
542
543 %contract pn_delivery_link(pn_delivery_t *delivery)
544 {
545 require:
546 delivery != NULL;
547 }
548
549 %contract pn_delivery_local_state(pn_delivery_t *delivery)
550 {
551 require:
552 delivery != NULL;
553 }
554
555 %contract pn_delivery_remote_state(pn_delivery_t *delivery)
556 {
557 require:
558 delivery != NULL;
559 }
560
561 %contract pn_delivery_settled(pn_delivery_t *delivery)
562 {
563 require:
564 delivery != NULL;
565 }
566
567 %contract pn_delivery_pending(pn_delivery_t *delivery)
568 {
569 require:
570 delivery != NULL;
571 }
572
573 %contract pn_delivery_writable(pn_delivery_t *delivery)
574 {
575 require:
576 delivery != NULL;
577 }
578
579 %contract pn_delivery_readable(pn_delivery_t *delivery)
580 {
581 require:
582 delivery != NULL;
583 }
584
585 %contract pn_delivery_updated(pn_delivery_t *delivery)
586 {
587 require:
588 delivery != NULL;
589 }
590
591 %contract pn_delivery_clear(pn_delivery_t *delivery)
592 {
593 require:
594 delivery != NULL;
595 }
596
597 %contract pn_delivery_update(pn_delivery_t *delivery, pn_disposition_t disposition)
598 {
599 require:
600 delivery != NULL;
601 check_disposition(disposition);
602 }
603
604 %contract pn_delivery_settle(pn_delivery_t *delivery)
605 {
606 require:
607 delivery != NULL;
608 }
609
610 %contract pn_delivery_dump(pn_delivery_t *delivery)
611 {
612 require:
613 delivery != NULL;
614 }
615
616 %include "proton/condition.h"
617 %include "proton/connection.h"
618 %include "proton/session.h"
619 %include "proton/link.h"
620 %include "proton/terminus.h"
621 %include "proton/delivery.h"
622 %include "proton/disposition.h"
623 %ignore pn_transport_vlogf;
624 %include "proton/transport.h"
625 %include "proton/event.h"
626
627 %inline %{
628 /* assume the binding does the incref in the wrapper */
629 pn_event_t* pn_event_copy(pn_event_t *evt) { return evt; }
630 %}
631
632 %contract pn_event_copy(pn_event_t *evt)
633 {
634 require:
635 evt != NULL;
636 }
637
638 %contract pn_message_free(pn_message_t *msg)
639 {
640 require:
641 msg != NULL;
642 }
643
644 %contract pn_message_clear(pn_message_t *msg)
645 {
646 require:
647 msg != NULL;
648 }
649
650 %contract pn_message_errno(pn_message_t *msg)
651 {
652 require:
653 msg != NULL;
654 }
655
656 %contract pn_message_error(pn_message_t *msg)
657 {
658 require:
659 msg != NULL;
660 }
661
662 %contract pn_message_is_durable(pn_message_t *msg)
663 {
664 require:
665 msg != NULL;
666 }
667
668 %contract pn_message_set_durable(pn_message_t *msg, bool durable)
669 {
670 require:
671 msg != NULL;
672 }
673
674 %contract pn_message_get_priority(pn_message_t *msg)
675 {
676 require:
677 msg != NULL;
678 }
679
680 %contract pn_message_set_priority(pn_message_t *msg, uint8_t priority)
681 {
682 require:
683 msg != NULL;
684 }
685
686 %contract pn_message_get_ttl(pn_message_t *msg)
687 {
688 require:
689 msg != NULL;
690 }
691
692 %contract pn_message_set_ttl(pn_message_t *msg, pn_millis_t ttl)
693 {
694 require:
695 msg != NULL;
696 }
697
698 %contract pn_message_is_first_acquirer(pn_message_t *msg)
699 {
700 require:
701 msg != NULL;
702 }
703
704 %contract pn_message_set_first_acquirer(pn_message_t *msg, bool first)
705 {
706 require:
707 msg != NULL;
708 }
709
710 %contract pn_message_get_delivery_count(pn_message_t *msg)
711 {
712 require:
713 msg != NULL;
714 }
715
716 %contract pn_message_set_delivery_count(pn_message_t *msg, uint32_t count)
717 {
718 require:
719 msg != NULL;
720 }
721
722 %contract pn_message_get_id(pn_message_t *msg)
723 {
724 require:
725 msg != NULL;
726 }
727
728 %contract pn_message_set_id(pn_message_t *msg, pn_atom_t id)
729 {
730 require:
731 msg != NULL;
732 }
733
734 %contract pn_message_get_user_id(pn_message_t *msg)
735 {
736 require:
737 msg != NULL;
738 }
739
740 %contract pn_message_set_user_id(pn_message_t *msg, pn_bytes_t user_id)
741 {
742 require:
743 msg != NULL;
744 }
745
746 %contract pn_message_get_address(pn_message_t *msg)
747 {
748 require:
749 msg != NULL;
750 }
751
752 %contract pn_message_set_address(pn_message_t *msg, const char *address)
753 {
754 require:
755 msg != NULL;
756 }
757
758 %contract pn_message_get_subject(pn_message_t *msg)
759 {
760 require:
761 msg != NULL;
762 }
763
764 %contract pn_message_set_subject(pn_message_t *msg, const char *subject)
765 {
766 require:
767 msg != NULL;
768 }
769
770 %contract pn_message_get_reply_to(pn_message_t *msg)
771 {
772 require:
773 msg != NULL;
774 }
775
776 %contract pn_message_set_reply_to(pn_message_t *msg, const char *reply_to)
777 {
778 require:
779 msg != NULL;
780 }
781
782 %contract pn_message_get_correlation_id(pn_message_t *msg)
783 {
784 require:
785 msg != NULL;
786 }
787
788 %contract pn_message_set_correlation_id(pn_message_t *msg, pn_atom_t atom)
789 {
790 require:
791 msg != NULL;
792 }
793
794 %contract pn_message_get_content_type(pn_message_t *msg)
795 {
796 require:
797 msg != NULL;
798 }
799
800 %contract pn_message_set_content_type(pn_message_t *msg, const char *type)
801 {
802 require:
803 msg != NULL;
804 }
805
806 %contract pn_message_get_content_encoding(pn_message_t *msg)
807 {
808 require:
809 msg != NULL;
810 }
811
812 %contract pn_message_set_content_encoding(pn_message_t *msg, const char *encoding)
813 {
814 require:
815 msg != NULL;
816 }
817
818 %contract pn_message_get_expiry_time(pn_message_t *msg)
819 {
820 require:
821 msg != NULL;
822 }
823
824 %contract pn_message_set_expiry_time(pn_message_t *msg, pn_timestamp_t time)
825 {
826 require:
827 msg != NULL;
828 }
829
830 %contract pn_message_get_creation_time(pn_message_t *msg)
831 {
832 require:
833 msg != NULL;
834 }
835
836 %contract pn_message_set_creation_time(pn_message_t *msg, pn_timestamp_t time)
837 {
838 require:
839 msg != NULL;
840 }
841
842 %contract pn_message_get_group_id(pn_message_t *msg)
843 {
844 require:
845 msg != NULL;
846 }
847
848 %contract pn_message_set_group_id(pn_message_t *msg, const char *group_id)
849 {
850 require:
851 msg != NULL;
852 }
853
854 %contract pn_message_get_group_sequence(pn_message_t *msg)
855 {
856 require:
857 msg != NULL;
858 }
859
860 %contract pn_message_set_group_sequence(pn_message_t *msg, pn_sequence_t n)
861 {
862 require:
863 msg != NULL;
864 }
865
866 %contract pn_message_get_reply_to_group_id(pn_message_t *msg)
867 {
868 require:
869 msg != NULL;
870 }
871
872 %contract pn_message_set_reply_to_group_id(pn_message_t *msg, const char *reply_to_group_id)
873 {
874 require:
875 msg != NULL;
876 }
877
878 %contract pn_message_decode(pn_message_t *msg, const char *bytes, size_t size)
879 {
880 require:
881 msg != NULL;
882 }
883
884 %contract pn_message_encode(pn_message_t *msg, char *bytes, size_t *size)
885 {
886 require:
887 msg != NULL;
888 *size >= 0;
889 }
890
891 %include "proton/message.h"
892
893 %contract pn_sasl()
894 {
895 ensure:
896 pn_sasl != NULL;
897 }
898
899 %contract pn_sasl_allowed_mechs(pn_sasl_t *sasl, const char *mechanisms)
900 {
901 require:
902 sasl != NULL;
903 }
904
905
906 %contract pn_sasl_done(pn_sasl_t *sasl, pn_sasl_outcome_t outcome)
907 {
908 require:
909 sasl != NULL;
910 check_sasl_outcome(outcome);
911 }
912
913 %contract pn_sasl_outcome(pn_sasl_t *sasl)
914 {
915 require:
916 sasl != NULL;
917 ensure:
918 check_sasl_outcome(pn_sasl_outcome);
919 }
920
921 %include "proton/sasl.h"
922
923 %include "proton/ssl.h"
924
925 %ignore pn_decode_atoms;
926 %ignore pn_encode_atoms;
927 %ignore pn_decode_one;
928
929 %ignore pn_print_atom;
930 %ignore pn_type_str;
931 %ignore pn_print_atoms;
932 %ignore pn_format_atoms;
933 %ignore pn_format_atom;
934
935 %ignore pn_fill_atoms;
936 %ignore pn_vfill_atoms;
937 %ignore pn_ifill_atoms;
938 %ignore pn_vifill_atoms;
939 %ignore pn_scan_atoms;
940 %ignore pn_vscan_atoms;
941 %ignore pn_data_vfill;
942 %ignore pn_data_vscan;
943
944 %include "proton/codec.h"
945
946 %inline %{
947 pn_connection_t *pn_cast_pn_connection(void *x) { return (pn_connection_t *) x; }
948 pn_session_t *pn_cast_pn_session(void *x) { return (pn_session_t *) x; }
949 pn_link_t *pn_cast_pn_link(void *x) { return (pn_link_t *) x; }
950 pn_delivery_t *pn_cast_pn_delivery(void *x) { return (pn_delivery_t *) x; }
951 pn_transport_t *pn_cast_pn_transport(void *x) { return (pn_transport_t *) x; }
952 %}
953
954 /* Connection driver */
955 %{
956 #include <proton/connection_driver.h>
957 %}
958 /* Don't wrap the pn_connection_driver_t struct, just the functions */
959 %ignore pn_connection_driver_t;
960 %ignore pn_connection_driver_verrorf;
961 %ignore pn_connection_driver_logf;
962 %ignore pn_connection_driver_vlogf;
963 %include "proton/connection_driver.h"
964
965 %include "proton/cid.h"