1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564
|
/* -*- c -*-
*
* Copyright (C) 2004-2006 Daniel P. Berrange
*
* This program is free software; You can redistribute it and/or modify
* it under the same terms as Perl itself. Either:
*
* a) the GNU General Public License as published by the Free
* Software Foundation; either version 2, or (at your option) any
* later version,
*
* or
*
* b) the "Artistic License"
*
* The file "COPYING" distributed along with this file provides full
* details of the terms and conditions of the two licenses.
*/
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include <dbus/dbus.h>
#if NET_DBUS_DEBUG
static int net_dbus_debug = 0;
#define DEBUG_MSG(...) if (net_dbus_debug) fprintf(stderr, __VA_ARGS__)
#else
#define DEBUG_MSG(...)
#endif
/*
* On 32-bit OS (and some 64-bit) Perl does not have an
* integer type capable of storing 64 bit numbers. So
* we serialize to/from strings on these platforms
*/
dbus_int64_t
_dbus_parse_int64(SV *sv) {
#ifdef USE_64_BIT_ALL
return SvIV(sv);
#else
//DEBUG_MSG("Parrse %s\n", SvPV_nolen(sv));
return strtoll(SvPV_nolen(sv), NULL, 10);
#endif
}
dbus_uint64_t
_dbus_parse_uint64(SV *sv) {
#ifdef USE_64_BIT_ALL
return SvUV(sv);
#else
//DEBUG_MSG("Parrse %s\n", SvPV_nolen(sv));
return strtoull(SvPV_nolen(sv), NULL, 10);
#endif
}
#ifndef PRId64
#define PRId64 "lld"
#endif
SV *
_dbus_format_int64(dbus_int64_t val) {
#ifdef USE_64_BIT_ALL
return newSViv(val);
#else
char buf[100];
int len;
len = snprintf(buf, 100, "%" PRId64, val);
//DEBUG_MSG("Format i64 [%" PRId64 "] to [%s]\n", val, buf);
return newSVpv(buf, len);
#endif
}
#ifndef PRIu64
#define PRIu64 "llu"
#endif
SV *
_dbus_format_uint64(dbus_uint64_t val) {
#ifdef USE_64_BIT_ALL
return newSVuv(val);
#else
char buf[100];
int len;
len = snprintf(buf, 100, "%" PRIu64, val);
//DEBUG_MSG("Format u64 [%" PRIu64 "] to [%s]\n", val, buf);
return newSVpv(buf, len);
#endif
}
/* The -1 is required by the contract for
dbus_{server,connection}_allocate_slot
initialization */
dbus_int32_t connection_data_slot = -1;
dbus_int32_t server_data_slot = -1;
dbus_int32_t pending_call_data_slot = -1;
void
_object_release(void *obj) {
DEBUG_MSG("Releasing object count on %p\n", obj);
SvREFCNT_dec((SV*)obj);
}
dbus_bool_t
_watch_generic(DBusWatch *watch, void *data, char *key, dbus_bool_t server) {
SV *selfref;
HV *self;
SV **call;
SV *h_sv;
dSP;
DEBUG_MSG("Watch generic callback %p %p %s %d\n", watch, data, key, server);
if (server) {
selfref = (SV*)dbus_server_get_data((DBusServer*)data, server_data_slot);
} else {
selfref = (SV*)dbus_connection_get_data((DBusConnection*)data, connection_data_slot);
}
self = (HV*)SvRV(selfref);
DEBUG_MSG("Got owner %p\n", self);
call = hv_fetch(self, key, strlen(key), 0);
if (!call) {
warn("Could not find watch callback %s for fd %d\n",
key, dbus_watch_get_fd(watch));
return FALSE;
}
ENTER;
SAVETMPS;
PUSHMARK(SP);
XPUSHs(selfref);
h_sv = sv_newmortal();
sv_setref_pv(h_sv, "Net::DBus::Binding::C::Watch", (void*)watch);
XPUSHs(h_sv);
PUTBACK;
call_sv(*call, G_DISCARD);
FREETMPS;
LEAVE;
return 1;
}
dbus_bool_t
_watch_server_add(DBusWatch *watch, void *data) {
return _watch_generic(watch, data, "add_watch", 1);
}
void
_watch_server_remove(DBusWatch *watch, void *data) {
_watch_generic(watch, data, "remove_watch", 1);
}
void
_watch_server_toggled(DBusWatch *watch, void *data) {
_watch_generic(watch, data, "toggled_watch", 1);
}
dbus_bool_t
_watch_connection_add(DBusWatch *watch, void *data) {
return _watch_generic(watch, data, "add_watch", 0);
}
void
_watch_connection_remove(DBusWatch *watch, void *data) {
_watch_generic(watch, data, "remove_watch", 0);
}
void
_watch_connection_toggled(DBusWatch *watch, void *data) {
_watch_generic(watch, data, "toggled_watch", 0);
}
dbus_bool_t
_timeout_generic(DBusTimeout *timeout, void *data, char *key, dbus_bool_t server) {
SV *selfref;
HV *self;
SV **call;
SV *h_sv;
dSP;
if (server) {
selfref = (SV*)dbus_server_get_data((DBusServer*)data, server_data_slot);
} else {
selfref = (SV*)dbus_connection_get_data((DBusConnection*)data, connection_data_slot);
}
self = (HV*)SvRV(selfref);
call = hv_fetch(self, key, strlen(key), 0);
if (!call) {
warn("Could not find timeout callback for %s\n", key);
return FALSE;
}
ENTER;
SAVETMPS;
PUSHMARK(SP);
XPUSHs((SV*)selfref);
h_sv = sv_newmortal();
sv_setref_pv(h_sv, "Net::DBus::Binding::C::Timeout", (void*)timeout);
XPUSHs(h_sv);
PUTBACK;
call_sv(*call, G_DISCARD);
FREETMPS;
LEAVE;
return 1;
}
dbus_bool_t
_timeout_server_add(DBusTimeout *timeout, void *data) {
return _timeout_generic(timeout, data, "add_timeout", 1);
}
void
_timeout_server_remove(DBusTimeout *timeout, void *data) {
_timeout_generic(timeout, data, "remove_timeout", 1);
}
void
_timeout_server_toggled(DBusTimeout *timeout, void *data) {
_timeout_generic(timeout, data, "toggled_timeout", 1);
}
dbus_bool_t
_timeout_connection_add(DBusTimeout *timeout, void *data) {
return _timeout_generic(timeout, data, "add_timeout", 0);
}
void
_timeout_connection_remove(DBusTimeout *timeout, void *data) {
_timeout_generic(timeout, data, "remove_timeout", 0);
}
void
_timeout_connection_toggled(DBusTimeout *timeout, void *data) {
_timeout_generic(timeout, data, "toggled_timeout", 0);
}
void
_connection_callback (DBusServer *server,
DBusConnection *new_connection,
void *data) {
SV *selfref = (SV*)dbus_server_get_data((DBusServer*)data, server_data_slot);
HV *self = (HV*)SvRV(selfref);
SV **call;
SV *value;
dSP;
call = hv_fetch(self, "_callback", strlen("_callback"), 0);
if (!call) {
warn("Could not find new connection callback\n");
return;
}
DEBUG_MSG("Created connection in callback %p\n", new_connection);
/* The DESTROY method will de-ref it later */
dbus_connection_ref(new_connection);
value = sv_newmortal();
sv_setref_pv(value, "Net::DBus::Binding::C::Connection", (void*)new_connection);
ENTER;
SAVETMPS;
PUSHMARK(SP);
XPUSHs(selfref);
XPUSHs(value);
PUTBACK;
call_sv(*call, G_DISCARD);
FREETMPS;
LEAVE;
}
DBusHandlerResult
_message_filter(DBusConnection *con,
DBusMessage *msg,
void *data) {
SV *selfref;
HV *self;
SV *value;
int count;
int handled = 0;
dSP;
selfref = (SV*)dbus_connection_get_data(con, connection_data_slot);
self = (HV*)SvRV(selfref);
DEBUG_MSG("Create message in filter %p\n", msg);
DEBUG_MSG(" Type %d\n", dbus_message_get_type(msg));
DEBUG_MSG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : "");
DEBUG_MSG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : "");
DEBUG_MSG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : "");
/* Will be de-refed in the DESTROY method */
dbus_message_ref(msg);
value = sv_newmortal();
sv_setref_pv(value, "Net::DBus::Binding::C::Message", (void*)msg);
ENTER;
SAVETMPS;
PUSHMARK(SP);
XPUSHs((SV*)selfref);
XPUSHs(value);
XPUSHs(data);
PUTBACK;
count = call_method("_message_filter", G_SCALAR);
SPAGAIN;
if (count == 1) {
handled = POPi;
} else {
handled = 0;
}
PUTBACK;
DEBUG_MSG("Handled %d %d\n", count, handled);
FREETMPS;
LEAVE;
return handled ? DBUS_HANDLER_RESULT_HANDLED : DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
void
_pending_call_callback(DBusPendingCall *call,
void *data) {
SV *selfref;
HV *self;
dSP;
DEBUG_MSG("In pending call callback %p\n", call);
selfref = (SV*)dbus_pending_call_get_data(call, pending_call_data_slot);
self = (HV*)SvRV(selfref);
dbus_pending_call_ref(call);
ENTER;
SAVETMPS;
PUSHMARK(SP);
XPUSHs((SV*)selfref);
PUTBACK;
call_sv(data, G_DISCARD);
FREETMPS;
LEAVE;
}
void
_filter_release(void *data) {
SvREFCNT_dec(data);
}
void
_pending_call_notify_release(void *data) {
SvREFCNT_dec(data);
}
void
_path_unregister_callback(DBusConnection *con,
void *data) {
SvREFCNT_dec(data);
}
DBusHandlerResult
_path_message_callback(DBusConnection *con,
DBusMessage *msg,
void *data) {
SV *self = (SV*)dbus_connection_get_data(con, connection_data_slot);
SV *value;
dSP;
DEBUG_MSG("Got message in callback %p\n", msg);
DEBUG_MSG(" Type %d\n", dbus_message_get_type(msg));
DEBUG_MSG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : "");
DEBUG_MSG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : "");
DEBUG_MSG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : "");
/* Will be de-refed in the DESTROY method */
dbus_message_ref(msg);
value = sv_newmortal();
sv_setref_pv(value, "Net::DBus::Binding::C::Message", (void*)msg);
ENTER;
SAVETMPS;
PUSHMARK(SP);
XPUSHs(self);
XPUSHs(value);
PUTBACK;
call_sv((SV*)data, G_DISCARD);
FREETMPS;
LEAVE;
return DBUS_HANDLER_RESULT_HANDLED;
}
DBusObjectPathVTable _path_callback_vtable = {
_path_unregister_callback,
_path_message_callback,
NULL,
NULL,
NULL,
NULL
};
SV *
_sv_from_error (DBusError *error)
{
HV *hv;
if (!error) {
warn ("error is NULL");
return &PL_sv_undef;
}
if (!dbus_error_is_set (error)) {
warn ("error is unset");
return &PL_sv_undef;
}
hv = newHV ();
/* map DBusError attributes to hash keys */
hv_store (hv, "name", 4, newSVpv (error->name, 0), 0);
hv_store (hv, "message", 7, newSVpv (error->message, 0), 0);
return sv_bless (newRV_noinc ((SV*) hv), gv_stashpv ("Net::DBus::Error", TRUE));
}
void
_croak_error (DBusError *error)
{
sv_setsv (ERRSV, _sv_from_error (error));
/* croak does not return, so we free this now to avoid leaking */
dbus_error_free (error);
croak (Nullch);
}
void
_populate_constant(HV *href, char *name, int val)
{
hv_store(href, name, strlen(name), newSViv(val), 0);
}
#define REGISTER_CONSTANT(name, key) _populate_constant(constants, #key, name)
MODULE = Net::DBus PACKAGE = Net::DBus
PROTOTYPES: ENABLE
BOOT:
{
HV *constants;
if (getenv("NET_DBUS_DEBUG"))
net_dbus_debug = 1;
/* not the 'standard' way of doing perl constants, but a lot easier to maintain */
constants = perl_get_hv("Net::DBus::Binding::Bus::_constants", TRUE);
REGISTER_CONSTANT(DBUS_BUS_SYSTEM, SYSTEM);
REGISTER_CONSTANT(DBUS_BUS_SESSION, SESSION);
REGISTER_CONSTANT(DBUS_BUS_STARTER, STARTER);
constants = perl_get_hv("Net::DBus::Binding::Message::_constants", TRUE);
REGISTER_CONSTANT(DBUS_TYPE_ARRAY, TYPE_ARRAY);
REGISTER_CONSTANT(DBUS_TYPE_BOOLEAN, TYPE_BOOLEAN);
REGISTER_CONSTANT(DBUS_TYPE_BYTE, TYPE_BYTE);
REGISTER_CONSTANT(DBUS_TYPE_DOUBLE, TYPE_DOUBLE);
REGISTER_CONSTANT(DBUS_TYPE_INT16, TYPE_INT16);
REGISTER_CONSTANT(DBUS_TYPE_INT32, TYPE_INT32);
REGISTER_CONSTANT(DBUS_TYPE_INT64, TYPE_INT64);
REGISTER_CONSTANT(DBUS_TYPE_INVALID, TYPE_INVALID);
REGISTER_CONSTANT(DBUS_TYPE_STRUCT, TYPE_STRUCT);
REGISTER_CONSTANT(DBUS_TYPE_SIGNATURE, TYPE_SIGNATURE);
REGISTER_CONSTANT(DBUS_TYPE_OBJECT_PATH, TYPE_OBJECT_PATH);
REGISTER_CONSTANT(DBUS_TYPE_DICT_ENTRY, TYPE_DICT_ENTRY);
REGISTER_CONSTANT(DBUS_TYPE_STRING, TYPE_STRING);
REGISTER_CONSTANT(DBUS_TYPE_UINT16, TYPE_UINT16);
REGISTER_CONSTANT(DBUS_TYPE_UINT32, TYPE_UINT32);
REGISTER_CONSTANT(DBUS_TYPE_UINT64, TYPE_UINT64);
REGISTER_CONSTANT(DBUS_TYPE_VARIANT, TYPE_VARIANT);
REGISTER_CONSTANT(DBUS_MESSAGE_TYPE_METHOD_CALL, MESSAGE_TYPE_METHOD_CALL);
REGISTER_CONSTANT(DBUS_MESSAGE_TYPE_METHOD_RETURN, MESSAGE_TYPE_METHOD_RETURN);
REGISTER_CONSTANT(DBUS_MESSAGE_TYPE_ERROR, MESSAGE_TYPE_ERROR);
REGISTER_CONSTANT(DBUS_MESSAGE_TYPE_SIGNAL, MESSAGE_TYPE_SIGNAL);
REGISTER_CONSTANT(DBUS_MESSAGE_TYPE_INVALID, MESSAGE_TYPE_INVALID);
constants = perl_get_hv("Net::DBus::Binding::Watch::_constants", TRUE);
REGISTER_CONSTANT(DBUS_WATCH_READABLE, READABLE);
REGISTER_CONSTANT(DBUS_WATCH_WRITABLE, WRITABLE);
REGISTER_CONSTANT(DBUS_WATCH_ERROR, ERROR);
REGISTER_CONSTANT(DBUS_WATCH_HANGUP, HANGUP);
dbus_connection_allocate_data_slot(&connection_data_slot);
dbus_server_allocate_data_slot(&server_data_slot);
dbus_pending_call_allocate_data_slot(&pending_call_data_slot);
}
MODULE = Net::DBus::Binding::Connection PACKAGE = Net::DBus::Binding::Connection
PROTOTYPES: ENABLE
DBusConnection *
_open(address)
char *address;
PREINIT:
DBusError error;
DBusConnection *con;
CODE:
dbus_error_init(&error);
DEBUG_MSG("Open connection shared %s\n", address);
con = dbus_connection_open(address, &error);
if (!con) {
_croak_error (&error);
}
dbus_connection_ref(con);
RETVAL = con;
OUTPUT:
RETVAL
DBusConnection *
_open_private(address)
char *address;
PREINIT:
DBusError error;
DBusConnection *con;
CODE:
dbus_error_init(&error);
DEBUG_MSG("Open connection private %s\n", address);
con = dbus_connection_open_private(address, &error);
if (!con) {
_croak_error (&error);
}
dbus_connection_ref(con);
RETVAL = con;
OUTPUT:
RETVAL
MODULE = Net::DBus::Binding::C::Connection PACKAGE = Net::DBus::Binding::C::Connection
void
_set_owner(con, owner)
DBusConnection *con;
SV *owner;
CODE:
SvREFCNT_inc(owner);
dbus_connection_set_data(con, connection_data_slot, owner, _object_release);
void
dbus_connection_disconnect(con)
DBusConnection *con;
CODE:
DEBUG_MSG("Closing connection %p\n", con);
#if HAVE_CONN_DISCONNECT
dbus_connection_disconnect(con);
#else
dbus_connection_close(con);
#endif
void
dbus_connection_ref(con)
DBusConnection *con;
void
dbus_connection_unref(con)
DBusConnection *con;
int
dbus_connection_get_is_connected(con)
DBusConnection *con;
int
dbus_connection_get_is_authenticated(con)
DBusConnection *con;
void
dbus_connection_flush(con)
DBusConnection *con;
int
_send(con, msg)
DBusConnection *con;
DBusMessage *msg;
PREINIT:
dbus_uint32_t serial;
CODE:
if (!dbus_connection_send(con, msg, &serial)) {
croak("not enough memory to send message");
}
RETVAL = serial;
OUTPUT:
RETVAL
DBusMessage *
_send_with_reply_and_block(con, msg, timeout)
DBusConnection *con;
DBusMessage *msg;
int timeout;
PREINIT:
DBusMessage *reply;
DBusError error;
CODE:
dbus_error_init(&error);
if (!(reply = dbus_connection_send_with_reply_and_block(con, msg, timeout, &error))) {
_croak_error(&error);
}
DEBUG_MSG("Create msg reply %p\n", reply);
DEBUG_MSG(" Type %d\n", dbus_message_get_type(reply));
DEBUG_MSG(" Interface %s\n", dbus_message_get_interface(reply) ? dbus_message_get_interface(reply) : "");
DEBUG_MSG(" Path %s\n", dbus_message_get_path(reply) ? dbus_message_get_path(reply) : "");
DEBUG_MSG(" Member %s\n", dbus_message_get_member(reply) ? dbus_message_get_member(reply) : "");
RETVAL = reply;
OUTPUT:
RETVAL
DBusPendingCall *
_send_with_reply(con, msg, timeout)
DBusConnection *con;
DBusMessage *msg;
int timeout;
PREINIT:
DBusPendingCall *reply;
CODE:
if (!dbus_connection_send_with_reply(con, msg, &reply, timeout)) {
croak("not enough memory to send message");
}
DEBUG_MSG("Create pending call %p\n", reply);
RETVAL = reply;
OUTPUT:
RETVAL
DBusMessage *
dbus_connection_borrow_message(con)
DBusConnection *con;
void
dbus_connection_return_message(con, msg)
DBusConnection *con;
DBusMessage *msg;
void
dbus_connection_steal_borrowed_message(con, msg)
DBusConnection *con;
DBusMessage *msg;
DBusMessage *
dbus_connection_pop_message(con)
DBusConnection *con;
void
_dispatch(con)
DBusConnection *con;
CODE:
DEBUG_MSG("IN dispatch\n");
while(dbus_connection_dispatch(con) == DBUS_DISPATCH_DATA_REMAINS);
DEBUG_MSG("Completed \n");
void
_set_watch_callbacks(con)
DBusConnection *con;
CODE:
if (!dbus_connection_set_watch_functions(con,
_watch_connection_add,
_watch_connection_remove,
_watch_connection_toggled,
con, NULL)) {
croak("not enough memory to set watch functions on connection");
}
void
_set_timeout_callbacks(con)
DBusConnection *con;
CODE:
if (!dbus_connection_set_timeout_functions(con,
_timeout_connection_add,
_timeout_connection_remove,
_timeout_connection_toggled,
con, NULL)) {
croak("not enough memory to set timeout functions on connection");
}
void
_register_object_path(con, path, code)
DBusConnection *con;
char *path;
SV *code;
CODE:
SvREFCNT_inc(code);
if (!(dbus_connection_register_object_path(con, path, &_path_callback_vtable, code))) {
croak("failure when registering object path");
}
void
_unregister_object_path(con, path)
DBusConnection *con;
char *path;
CODE:
/* The associated data will be free'd by the previously
registered callback */
if (!(dbus_connection_unregister_object_path(con, path))) {
croak("failure when unregistering object path");
}
void
_register_fallback(con, path, code)
DBusConnection *con;
char *path;
SV *code;
CODE:
SvREFCNT_inc(code);
if (!(dbus_connection_register_fallback(con, path, &_path_callback_vtable, code))) {
croak("failure when registering fallback object path");
}
void
_add_filter(con, code)
DBusConnection *con;
SV *code;
CODE:
SvREFCNT_inc(code);
DEBUG_MSG("Adding filter %p\n", code);
dbus_connection_add_filter(con, _message_filter, code, _filter_release);
dbus_bool_t
dbus_bus_register(con)
DBusConnection *con;
PREINIT:
DBusError error;
int reply;
CODE:
dbus_error_init(&error);
if (!(reply = dbus_bus_register(con, &error))) {
_croak_error(&error);
}
RETVAL = reply;
void
dbus_bus_add_match(con, rule)
DBusConnection *con;
char *rule;
PREINIT:
DBusError error;
CODE:
dbus_error_init(&error);
DEBUG_MSG("Adding match %s\n", rule);
dbus_bus_add_match(con, rule, &error);
if (dbus_error_is_set(&error)) {
_croak_error(&error);
}
void
dbus_bus_remove_match(con, rule)
DBusConnection *con;
char *rule;
PREINIT:
DBusError error;
CODE:
dbus_error_init(&error);
DEBUG_MSG("Removeing match %s\n", rule);
dbus_bus_remove_match(con, rule, &error);
if (dbus_error_is_set(&error)) {
_croak_error(&error);
}
const char *
dbus_bus_get_unique_name(con)
DBusConnection *con;
int
dbus_bus_request_name(con, service_name)
DBusConnection *con;
char *service_name;
PREINIT:
DBusError error;
int reply;
CODE:
dbus_error_init(&error);
if (!(reply = dbus_bus_request_name(con, service_name, 0, &error))) {
_croak_error(&error);
}
RETVAL = reply;
OUTPUT:
RETVAL
void
DESTROY(con)
DBusConnection *con;
CODE:
DEBUG_MSG("Unrefing connection %p\n", con);
dbus_connection_unref(con);
MODULE = Net::DBus::Binding::Server PACKAGE = Net::DBus::Binding::Server
PROTOTYPES: ENABLE
DBusServer *
_open(address)
char *address;
PREINIT:
DBusError error;
DBusServer *server;
CODE:
dbus_error_init(&error);
server = dbus_server_listen(address, &error);
DEBUG_MSG("Created server %p on address %s\n", server, address);
if (!server) {
_croak_error(&error);
}
if (!dbus_server_set_auth_mechanisms(server, NULL)) {
croak("not enough memory to server auth mechanisms");
}
RETVAL = server;
OUTPUT:
RETVAL
MODULE = Net::DBus::Binding::C::Server PACKAGE = Net::DBus::Binding::C::Server
void
_set_owner(server, owner)
DBusServer *server;
SV *owner;
CODE:
SvREFCNT_inc(owner);
dbus_server_set_data(server, server_data_slot, owner, _object_release);
void
dbus_server_disconnect(server)
DBusServer *server;
int
dbus_server_get_is_connected(server)
DBusServer *server;
void
_set_watch_callbacks(server)
DBusServer *server;
CODE:
if (!dbus_server_set_watch_functions(server,
_watch_server_add,
_watch_server_remove,
_watch_server_toggled,
server, NULL)) {
croak("not enough memory to set watch functions on server");
}
void
_set_timeout_callbacks(server)
DBusServer *server;
CODE:
if (!dbus_server_set_timeout_functions(server,
_timeout_server_add,
_timeout_server_remove,
_timeout_server_toggled,
server, NULL)) {
croak("not enough memory to set timeout functions on server");
}
void
_set_connection_callback(server)
DBusServer *server;
CODE:
dbus_server_set_new_connection_function(server,
_connection_callback,
server, NULL);
void
DESTROY(server)
DBusServer *server;
CODE:
DEBUG_MSG("Destroying server %p\n", server);
dbus_server_unref(server);
MODULE = Net::DBus::Binding::Bus PACKAGE = Net::DBus::Binding::Bus
PROTOTYPES: ENABLE
DBusConnection *
_open(type)
DBusBusType type;
PREINIT:
DBusError error;
DBusConnection *con;
CODE:
dbus_error_init(&error);
DEBUG_MSG("Open bus shared %d\n", type);
con = dbus_bus_get(type, &error);
if (!con) {
_croak_error(&error);
}
dbus_connection_ref(con);
RETVAL = con;
OUTPUT:
RETVAL
DBusConnection *
_open_private(type)
DBusBusType type;
PREINIT:
DBusError error;
DBusConnection *con;
CODE:
dbus_error_init(&error);
DEBUG_MSG("Open bus private %d\n", type);
con = dbus_bus_get_private(type, &error);
if (!con) {
_croak_error(&error);
}
dbus_connection_ref(con);
RETVAL = con;
OUTPUT:
RETVAL
MODULE = Net::DBus::Binding::Message PACKAGE = Net::DBus::Binding::Message
PROTOTYPES: ENABLE
DBusMessage *
_create(type)
IV type;
PREINIT:
DBusMessage *msg;
CODE:
msg = dbus_message_new(type);
if (!msg) {
croak("No memory to allocate message");
}
DEBUG_MSG("Create msg new %p\n", msg);
DEBUG_MSG(" Type %d\n", dbus_message_get_type(msg));
RETVAL = msg;
OUTPUT:
RETVAL
DBusMessageIter *
_iterator_append(msg)
DBusMessage *msg;
CODE:
RETVAL = dbus_new(DBusMessageIter, 1);
dbus_message_iter_init_append(msg, RETVAL);
OUTPUT:
RETVAL
DBusMessageIter *
_iterator(msg)
DBusMessage *msg;
CODE:
RETVAL = dbus_new(DBusMessageIter, 1);
dbus_message_iter_init(msg, RETVAL);
OUTPUT:
RETVAL
MODULE = Net::DBus::Binding::C::Message PACKAGE = Net::DBus::Binding::C::Message
void
DESTROY(msg)
DBusMessage *msg;
CODE:
DEBUG_MSG("De-referencing message %p\n", msg);
DEBUG_MSG(" Type %d\n", dbus_message_get_type(msg));
DEBUG_MSG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : "");
DEBUG_MSG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : "");
DEBUG_MSG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : "");
dbus_message_unref(msg);
dbus_bool_t
dbus_message_get_no_reply(msg)
DBusMessage *msg;
void
dbus_message_set_no_reply(msg,flag)
DBusMessage *msg;
dbus_bool_t flag;
int
dbus_message_get_type(msg)
DBusMessage *msg;
const char *
dbus_message_get_interface(msg)
DBusMessage *msg;
const char *
dbus_message_get_path(msg)
DBusMessage *msg;
const char *
dbus_message_get_destination(msg)
DBusMessage *msg;
const char *
dbus_message_get_sender(msg)
DBusMessage *msg;
dbus_uint32_t
dbus_message_get_serial(msg)
DBusMessage *msg;
const char *
dbus_message_get_member(msg)
DBusMessage *msg;
const char *
dbus_message_get_error_name(msg)
DBusMessage *msg;
const char *
dbus_message_get_signature(msg)
DBusMessage *msg;
void
dbus_message_set_sender(msg, sender);
DBusMessage *msg;
const char *sender;
void
dbus_message_set_destination(msg, dest);
DBusMessage *msg;
const char *dest;
MODULE = Net::DBus::Binding::Message::Signal PACKAGE = Net::DBus::Binding::Message::Signal
PROTOTYPES: ENABLE
DBusMessage *
_create(path, interface, name)
char *path;
char *interface;
char *name;
PREINIT:
DBusMessage *msg;
CODE:
msg = dbus_message_new_signal(path, interface, name);
if (!msg) {
croak("No memory to allocate message");
}
DEBUG_MSG("Create msg new signal %p\n", msg);
DEBUG_MSG(" Type %d\n", dbus_message_get_type(msg));
DEBUG_MSG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : "");
DEBUG_MSG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : "");
DEBUG_MSG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : "");
RETVAL = msg;
OUTPUT:
RETVAL
MODULE = Net::DBus::Binding::Message::MethodCall PACKAGE = Net::DBus::Binding::Message::MethodCall
PROTOTYPES: ENABLE
DBusMessage *
_create(service, path, interface, method)
char *service;
char *path;
char *interface;
char *method;
PREINIT:
DBusMessage *msg;
CODE:
msg = dbus_message_new_method_call(service, path, interface, method);
if (!msg) {
croak("No memory to allocate message");
}
DEBUG_MSG("Create msg new method call %p\n", msg);
DEBUG_MSG(" Type %d\n", dbus_message_get_type(msg));
DEBUG_MSG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : "");
DEBUG_MSG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : "");
DEBUG_MSG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : "");
RETVAL = msg;
OUTPUT:
RETVAL
MODULE = Net::DBus::Binding::Message::MethodReturn PACKAGE = Net::DBus::Binding::Message::MethodReturn
PROTOTYPES: ENABLE
DBusMessage *
_create(call)
DBusMessage *call;
PREINIT:
DBusMessage *msg;
CODE:
msg = dbus_message_new_method_return(call);
if (!msg) {
croak("No memory to allocate message");
}
dbus_message_set_interface(msg, dbus_message_get_interface(call));
dbus_message_set_path(msg, dbus_message_get_path(call));
dbus_message_set_member(msg, dbus_message_get_member(call));
DEBUG_MSG("Create msg new method return %p\n", msg);
DEBUG_MSG(" Type %d\n", dbus_message_get_type(msg));
DEBUG_MSG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : "");
DEBUG_MSG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : "");
DEBUG_MSG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : "");
RETVAL = msg;
OUTPUT:
RETVAL
MODULE = Net::DBus::Binding::Message::Error PACKAGE = Net::DBus::Binding::Message::Error
PROTOTYPES: ENABLE
DBusMessage *
_create(replyto, name, message)
DBusMessage *replyto;
char *name;
char *message;
PREINIT:
DBusMessage *msg;
CODE:
msg = dbus_message_new_error(replyto, name, message);
if (!msg) {
croak("No memory to allocate message");
}
DEBUG_MSG("Create msg new error %p\n", msg);
DEBUG_MSG(" Type %d\n", dbus_message_get_type(msg));
DEBUG_MSG(" Interface %s\n", dbus_message_get_interface(msg) ? dbus_message_get_interface(msg) : "");
DEBUG_MSG(" Path %s\n", dbus_message_get_path(msg) ? dbus_message_get_path(msg) : "");
DEBUG_MSG(" Member %s\n", dbus_message_get_member(msg) ? dbus_message_get_member(msg) : "");
RETVAL = msg;
OUTPUT:
RETVAL
MODULE = Net::DBus::Binding::C::PendingCall PACKAGE = Net::DBus::Binding::C::PendingCall
PROTOTYPES: ENABLE
DBusMessage *
_steal_reply(call)
DBusPendingCall *call;
PREINIT:
DBusMessage *msg;
CODE:
DEBUG_MSG("Stealing pending call reply %p\n", call);
msg = dbus_pending_call_steal_reply(call);
dbus_message_ref(msg);
DEBUG_MSG("Got reply message %p\n", msg);
RETVAL = msg;
OUTPUT:
RETVAL
void
dbus_pending_call_block(call)
DBusPendingCall *call;
dbus_bool_t
dbus_pending_call_get_completed(call)
DBusPendingCall *call;
void
dbus_pending_call_cancel(call)
DBusPendingCall *call;
void
_set_notify(call, code)
DBusPendingCall *call;
SV *code;
CODE:
SvREFCNT_inc(code);
DEBUG_MSG("Adding pending call notify %p\n", code);
dbus_pending_call_set_notify(call, _pending_call_callback, code, _pending_call_notify_release);
void
DESTROY (call)
DBusPendingCall *call;
CODE:
DEBUG_MSG("Unrefing pending call %p", call);
dbus_pending_call_unref(call);
MODULE = Net::DBus::Binding::C::Watch PACKAGE = Net::DBus::Binding::C::Watch
int
get_fileno(watch)
DBusWatch *watch;
CODE:
RETVAL = dbus_watch_get_fd(watch);
OUTPUT:
RETVAL
unsigned int
get_flags(watch)
DBusWatch *watch;
CODE:
RETVAL = dbus_watch_get_flags(watch);
OUTPUT:
RETVAL
dbus_bool_t
is_enabled(watch)
DBusWatch *watch;
CODE:
RETVAL = dbus_watch_get_enabled(watch);
OUTPUT:
RETVAL
void
handle(watch, flags)
DBusWatch *watch;
unsigned int flags;
CODE:
DEBUG_MSG("Handling event %d on fd %d (%p)\n", flags, dbus_watch_get_fd(watch), watch);
dbus_watch_handle(watch, flags);
void *
get_data(watch)
DBusWatch *watch;
CODE:
RETVAL = dbus_watch_get_data(watch);
OUTPUT:
RETVAL
void
set_data(watch, data)
DBusWatch *watch;
void *data;
CODE:
dbus_watch_set_data(watch, data, NULL);
MODULE = Net::DBus::Binding::C::Timeout PACKAGE = Net::DBus::Binding::C::Timeout
int
get_interval(timeout)
DBusTimeout *timeout;
CODE:
RETVAL = dbus_timeout_get_interval(timeout);
OUTPUT:
RETVAL
dbus_bool_t
is_enabled(timeout)
DBusTimeout *timeout;
CODE:
RETVAL = dbus_timeout_get_enabled(timeout);
OUTPUT:
RETVAL
void
handle(timeout)
DBusTimeout *timeout;
CODE:
DEBUG_MSG("Handling timeout event %p\n", timeout);
dbus_timeout_handle(timeout);
void *
get_data(timeout)
DBusTimeout *timeout;
CODE:
RETVAL = dbus_timeout_get_data(timeout);
OUTPUT:
RETVAL
void
set_data(timeout, data)
DBusTimeout *timeout;
void *data;
CODE:
dbus_timeout_set_data(timeout, data, NULL);
MODULE = Net::DBus::Binding::Iterator PACKAGE = Net::DBus::Binding::Iterator
DBusMessageIter *
_recurse(iter)
DBusMessageIter *iter;
CODE:
RETVAL = dbus_new(DBusMessageIter, 1);
dbus_message_iter_recurse(iter, RETVAL);
OUTPUT:
RETVAL
DBusMessageIter *
_open_container(iter, type, sig)
DBusMessageIter *iter;
int type;
char *sig;
CODE:
RETVAL = dbus_new(DBusMessageIter, 1);
if (!dbus_message_iter_open_container(iter, type, sig && *sig == '\0' ? NULL : sig, RETVAL)) {
dbus_free(RETVAL);
croak("failed to open iterator container");
}
OUTPUT:
RETVAL
void
_close_container(iter, sub_iter)
DBusMessageIter *iter;
DBusMessageIter *sub_iter;
CODE:
dbus_message_iter_close_container(iter, sub_iter);
int
get_arg_type(iter)
DBusMessageIter *iter;
CODE:
RETVAL = dbus_message_iter_get_arg_type(iter);
OUTPUT:
RETVAL
int
get_element_type(iter)
DBusMessageIter *iter;
CODE:
RETVAL = dbus_message_iter_get_element_type(iter);
OUTPUT:
RETVAL
dbus_bool_t
has_next(iter)
DBusMessageIter *iter;
CODE:
RETVAL = dbus_message_iter_has_next(iter);
OUTPUT:
RETVAL
dbus_bool_t
next(iter)
DBusMessageIter *iter;
CODE:
RETVAL = dbus_message_iter_next(iter);
OUTPUT:
RETVAL
dbus_bool_t
get_boolean(iter)
DBusMessageIter *iter;
CODE:
dbus_message_iter_get_basic(iter, &RETVAL);
OUTPUT:
RETVAL
unsigned char
get_byte(iter)
DBusMessageIter *iter;
CODE:
dbus_message_iter_get_basic(iter, &RETVAL);
OUTPUT:
RETVAL
dbus_int16_t
get_int16(iter)
DBusMessageIter *iter;
CODE:
dbus_message_iter_get_basic(iter, &RETVAL);
OUTPUT:
RETVAL
dbus_uint16_t
get_uint16(iter)
DBusMessageIter *iter;
CODE:
dbus_message_iter_get_basic(iter, &RETVAL);
OUTPUT:
RETVAL
dbus_int32_t
get_int32(iter)
DBusMessageIter *iter;
CODE:
dbus_message_iter_get_basic(iter, &RETVAL);
OUTPUT:
RETVAL
dbus_uint32_t
get_uint32(iter)
DBusMessageIter *iter;
CODE:
dbus_message_iter_get_basic(iter, &RETVAL);
OUTPUT:
RETVAL
dbus_int64_t
_get_int64(iter)
DBusMessageIter *iter;
CODE:
dbus_message_iter_get_basic(iter, &RETVAL);
OUTPUT:
RETVAL
dbus_uint64_t
_get_uint64(iter)
DBusMessageIter *iter;
CODE:
dbus_message_iter_get_basic(iter, &RETVAL);
OUTPUT:
RETVAL
double
get_double(iter)
DBusMessageIter *iter;
CODE:
dbus_message_iter_get_basic(iter, &RETVAL);
OUTPUT:
RETVAL
char *
get_string(iter)
DBusMessageIter *iter;
CODE:
dbus_message_iter_get_basic(iter, &RETVAL);
OUTPUT:
RETVAL
char *
get_signature(iter)
DBusMessageIter *iter;
CODE:
dbus_message_iter_get_basic(iter, &RETVAL);
OUTPUT:
RETVAL
char *
get_object_path(iter)
DBusMessageIter *iter;
CODE:
dbus_message_iter_get_basic(iter, &RETVAL);
OUTPUT:
RETVAL
void
append_boolean(iter, val)
DBusMessageIter *iter;
dbus_bool_t val;
CODE:
if (!dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &val)) {
croak("cannot append boolean");
}
void
append_byte(iter, val)
DBusMessageIter *iter;
unsigned char val;
CODE:
if (!dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, &val)) {
croak("cannot append byte");
}
void
append_int16(iter, val)
DBusMessageIter *iter;
dbus_int16_t val;
CODE:
if (!dbus_message_iter_append_basic(iter, DBUS_TYPE_INT16, &val)) {
croak("cannot append int16");
}
void
append_uint16(iter, val)
DBusMessageIter *iter;
dbus_uint16_t val;
CODE:
if (!dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &val)) {
croak("cannot append uint16");
}
void
append_int32(iter, val)
DBusMessageIter *iter;
dbus_int32_t val;
CODE:
if (!dbus_message_iter_append_basic(iter, DBUS_TYPE_INT32, &val)) {
croak("cannot append int32");
}
void
append_uint32(iter, val)
DBusMessageIter *iter;
dbus_uint32_t val;
CODE:
if (!dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &val)) {
croak("cannot append uint32");
}
void
_append_int64(iter, val)
DBusMessageIter *iter;
dbus_int64_t val;
CODE:
if (!dbus_message_iter_append_basic(iter, DBUS_TYPE_INT64, &val)) {
croak("cannot append int64");
}
void
_append_uint64(iter, val)
DBusMessageIter *iter;
dbus_uint64_t val;
CODE:
if (!dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT64, &val)) {
croak("cannot append uint64");
}
void
append_double(iter, val)
DBusMessageIter *iter;
double val;
CODE:
if (!dbus_message_iter_append_basic(iter, DBUS_TYPE_DOUBLE, &val)) {
croak("cannot append double");
}
void
append_string(iter, val)
DBusMessageIter *iter;
char *val;
CODE:
if (!dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &val)) {
croak("cannot append string");
}
void
append_object_path(iter, val)
DBusMessageIter *iter;
char *val;
CODE:
if (!dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH, &val)) {
croak("cannot append object path");
}
void
append_signature(iter, val)
DBusMessageIter *iter;
char *val;
CODE:
if (!dbus_message_iter_append_basic(iter, DBUS_TYPE_SIGNATURE, &val)) {
croak("cannot append signature");
}
void
DESTROY(iter)
DBusMessageIter *iter;
CODE:
DEBUG_MSG("Destroying iterator %p\n", iter);
dbus_free(iter);
MODULE = Net::DBus PACKAGE = Net::DBus
|