]>
git.proxmox.com Git - proxmox-backup.git/blob - tests/proto-client.c
3 * $ gcc -o c-test-client tests/proto-client.c \
4 * -L target/debug/deps -Wl,-rpath -Wl,target/debug/deps -lproxmox_protocol
7 * $ ./c-test-client 'host/backup1/2019-03-06T10:06:52+01:00/foo.catar.fidx'
12 #include "../proxmox-protocol/proxmox-protocol.h"
14 static bool useClient(ProxmoxBackup
*client
, int argc
, char **argv
);
17 main(int argc
, char **argv
)
22 ProxmoxConnector
*connector
= proxmox_connector_new("root@pam", "127.0.0.1:8007", "local");
24 fprintf(stderr
, "failed to create connector: %m\n");
28 if (proxmox_connector_set_password(connector
, "12341234") != 0) {
29 fprintf(stderr
, "failed to set password: %m\n");
33 proxmox_connector_set_certificate_validation(connector
, false);
35 ProxmoxBackup
*client
= proxmox_connector_connect(connector
);
37 fprintf(stderr
, "failed to connect\n");
41 if (!useClient(client
, argc
, argv
)) {
42 const char *msg
= proxmox_backup_get_error(client
);
44 fprintf(stderr
, "proxmox client error: %s\n", msg
);
46 fprintf(stderr
, "unknown proxmox client error\n", msg
);
50 proxmox_backup_done(client
);
56 useClient(ProxmoxBackup
*client
, int argc
, char **argv
)
61 printf("requesting hashes for '%s'\n", argv
[1]);
62 int rc
= proxmox_backup_query_hashes(client
, argv
[1]);
67 printf("Wait iteration...\n");
68 int rc
= proxmox_backup_wait_for_hashes(client
);
75 printf("got hashes\n");