|
Packit |
f228a3 |
/*
|
|
Packit |
f228a3 |
* usbmuxd-proto.h - Protocol definition for the usbmux protocol.
|
|
Packit |
f228a3 |
*
|
|
Packit |
f228a3 |
* Copyright (C) 2009 Paul Sladen <libiphone@paul.sladen.org>
|
|
Packit |
f228a3 |
* Copyright (C) 2009 Nikias Bassen <nikias@gmx.li>
|
|
Packit |
f228a3 |
* Copyright (C) 2009 Hector Martin <hector@marcansoft.com>
|
|
Packit |
f228a3 |
*
|
|
Packit |
f228a3 |
* This library is free software; you can redistribute it and/or modify
|
|
Packit |
f228a3 |
* it under the terms of the GNU Lesser General Public License as
|
|
Packit |
f228a3 |
* published by the Free Software Foundation, either version 2.1 of the
|
|
Packit |
f228a3 |
* License, or (at your option) any later version.
|
|
Packit |
f228a3 |
*
|
|
Packit |
f228a3 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
f228a3 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
f228a3 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
f228a3 |
* GNU General Public License for more details.
|
|
Packit |
f228a3 |
*
|
|
Packit |
f228a3 |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
f228a3 |
* License along with this program; if not, write to the Free Software
|
|
Packit |
f228a3 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
Packit |
f228a3 |
*/
|
|
Packit |
f228a3 |
|
|
Packit |
f228a3 |
#ifndef USBMUXD_PROTO_H
|
|
Packit |
f228a3 |
#define USBMUXD_PROTO_H
|
|
Packit |
f228a3 |
|
|
Packit |
f228a3 |
#include <stdint.h>
|
|
Packit |
f228a3 |
#define USBMUXD_PROTOCOL_VERSION 0
|
|
Packit |
f228a3 |
|
|
Packit |
f228a3 |
#if defined(WIN32) || defined(__CYGWIN__)
|
|
Packit |
f228a3 |
#define USBMUXD_SOCKET_PORT 27015
|
|
Packit |
f228a3 |
#else
|
|
Packit |
f228a3 |
#define USBMUXD_SOCKET_FILE "/var/run/usbmuxd"
|
|
Packit |
f228a3 |
#endif
|
|
Packit |
f228a3 |
|
|
Packit |
f228a3 |
#ifdef __cplusplus
|
|
Packit |
f228a3 |
extern "C" {
|
|
Packit |
f228a3 |
#endif
|
|
Packit |
f228a3 |
|
|
Packit |
f228a3 |
enum usbmuxd_result {
|
|
Packit |
f228a3 |
RESULT_OK = 0,
|
|
Packit |
f228a3 |
RESULT_BADCOMMAND = 1,
|
|
Packit |
f228a3 |
RESULT_BADDEV = 2,
|
|
Packit |
f228a3 |
RESULT_CONNREFUSED = 3,
|
|
Packit |
f228a3 |
// ???
|
|
Packit |
f228a3 |
// ???
|
|
Packit |
f228a3 |
RESULT_BADVERSION = 6,
|
|
Packit |
f228a3 |
};
|
|
Packit |
f228a3 |
|
|
Packit |
f228a3 |
enum usbmuxd_msgtype {
|
|
Packit |
f228a3 |
MESSAGE_RESULT = 1,
|
|
Packit |
f228a3 |
MESSAGE_CONNECT = 2,
|
|
Packit |
f228a3 |
MESSAGE_LISTEN = 3,
|
|
Packit |
f228a3 |
MESSAGE_DEVICE_ADD = 4,
|
|
Packit |
f228a3 |
MESSAGE_DEVICE_REMOVE = 5,
|
|
Packit |
f228a3 |
//???
|
|
Packit |
f228a3 |
//???
|
|
Packit |
f228a3 |
MESSAGE_PLIST = 8,
|
|
Packit |
f228a3 |
};
|
|
Packit |
f228a3 |
|
|
Packit |
f228a3 |
struct usbmuxd_header {
|
|
Packit |
f228a3 |
uint32_t length; // length of message, including header
|
|
Packit |
f228a3 |
uint32_t version; // protocol version
|
|
Packit |
f228a3 |
uint32_t message; // message type
|
|
Packit |
f228a3 |
uint32_t tag; // responses to this query will echo back this tag
|
|
Packit |
f228a3 |
} __attribute__((__packed__));
|
|
Packit |
f228a3 |
|
|
Packit |
f228a3 |
struct usbmuxd_result_msg {
|
|
Packit |
f228a3 |
struct usbmuxd_header header;
|
|
Packit |
f228a3 |
uint32_t result;
|
|
Packit |
f228a3 |
} __attribute__((__packed__));
|
|
Packit |
f228a3 |
|
|
Packit |
f228a3 |
struct usbmuxd_connect_request {
|
|
Packit |
f228a3 |
struct usbmuxd_header header;
|
|
Packit |
f228a3 |
uint32_t device_id;
|
|
Packit |
f228a3 |
uint16_t port; // TCP port number
|
|
Packit |
f228a3 |
uint16_t reserved; // set to zero
|
|
Packit |
f228a3 |
} __attribute__((__packed__));
|
|
Packit |
f228a3 |
|
|
Packit |
f228a3 |
struct usbmuxd_listen_request {
|
|
Packit |
f228a3 |
struct usbmuxd_header header;
|
|
Packit |
f228a3 |
} __attribute__((__packed__));
|
|
Packit |
f228a3 |
|
|
Packit |
f228a3 |
struct usbmuxd_device_record {
|
|
Packit |
f228a3 |
uint32_t device_id;
|
|
Packit |
f228a3 |
uint16_t product_id;
|
|
Packit |
f228a3 |
char serial_number[256];
|
|
Packit |
f228a3 |
uint16_t padding;
|
|
Packit |
f228a3 |
uint32_t location;
|
|
Packit |
f228a3 |
} __attribute__((__packed__));
|
|
Packit |
f228a3 |
|
|
Packit |
f228a3 |
#ifdef __cplusplus
|
|
Packit |
f228a3 |
}
|
|
Packit |
f228a3 |
#endif
|
|
Packit |
f228a3 |
|
|
Packit |
f228a3 |
#endif /* USBMUXD_PROTO_H */
|