Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libplist
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pwn
libplist
Commits
a641dd49
Commit
a641dd49
authored
Aug 14, 2008
by
Matt Colyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed documentation in usbmux.c.
parent
540aaf87
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
17 deletions
+20
-17
usbmux.c
src/usbmux.c
+20
-17
No files found.
src/usbmux.c
View file @
a641dd49
...
@@ -32,6 +32,13 @@ extern int debug;
...
@@ -32,6 +32,13 @@ extern int debug;
static
usbmux_connection
**
connlist
=
NULL
;
static
usbmux_connection
**
connlist
=
NULL
;
static
int
connections
=
0
;
static
int
connections
=
0
;
/** Creates a USBMux packet for the given set of ports.
*
* @param s_port The source port for the connection.
* @param d_port The destination port for the connection.
*
* @return A USBMux packet
*/
usbmux_tcp_header
*
new_mux_packet
(
uint16
s_port
,
uint16
d_port
)
{
usbmux_tcp_header
*
new_mux_packet
(
uint16
s_port
,
uint16
d_port
)
{
usbmux_tcp_header
*
conn
=
(
usbmux_tcp_header
*
)
malloc
(
sizeof
(
usbmux_tcp_header
));
usbmux_tcp_header
*
conn
=
(
usbmux_tcp_header
*
)
malloc
(
sizeof
(
usbmux_tcp_header
));
conn
->
type
=
htonl
(
6
);
conn
->
type
=
htonl
(
6
);
...
@@ -47,6 +54,10 @@ usbmux_tcp_header *new_mux_packet(uint16 s_port, uint16 d_port) {
...
@@ -47,6 +54,10 @@ usbmux_tcp_header *new_mux_packet(uint16 s_port, uint16 d_port) {
return
conn
;
return
conn
;
}
}
/** Creates a USBMux header containing version information
*
* @return A USBMux header
*/
usbmux_version_header
*
version_header
()
{
usbmux_version_header
*
version_header
()
{
usbmux_version_header
*
version
=
(
usbmux_version_header
*
)
malloc
(
sizeof
(
usbmux_version_header
));
usbmux_version_header
*
version
=
(
usbmux_version_header
*
)
malloc
(
sizeof
(
usbmux_version_header
));
version
->
type
=
0
;
version
->
type
=
0
;
...
@@ -97,16 +108,14 @@ void add_connection(usbmux_connection *connection) {
...
@@ -97,16 +108,14 @@ void add_connection(usbmux_connection *connection) {
connections
++
;
connections
++
;
}
}
/** This is a higher-level USBMuxTCP-type function.
/** Initializes a connection on phone, with source port s_port and destination port d_port
* Initializes a connection on phone, with source port s_port and destination port d_port
*
*
* @param phone The iPhone to initialize a connection on.
* @param phone The iPhone to initialize a connection on.
* @param s_port The source port
* @param s_port The source port
* @param d_port The destination port -- 0xf27e for lockdownd.
* @param d_port The destination port -- 0xf27e for lockdownd.
* @return A mux TCP header for the connection which is used for tracking and data transfer.
*
*
* @return A mux TCP header for the connection which is used for tracking and data transfer.
*/
*/
usbmux_connection
*
mux_connect
(
iPhone
*
phone
,
uint16
s_port
,
uint16
d_port
)
{
usbmux_connection
*
mux_connect
(
iPhone
*
phone
,
uint16
s_port
,
uint16
d_port
)
{
if
(
!
phone
||
!
s_port
||
!
d_port
)
return
NULL
;
if
(
!
phone
||
!
s_port
||
!
d_port
)
return
NULL
;
int
bytes
=
0
;
int
bytes
=
0
;
...
@@ -144,14 +153,11 @@ usbmux_connection *mux_connect(iPhone *phone, uint16 s_port, uint16 d_port) {
...
@@ -144,14 +153,11 @@ usbmux_connection *mux_connect(iPhone *phone, uint16 s_port, uint16 d_port) {
return
NULL
;
return
NULL
;
}
}
/**
/**
Cleans up the given USBMux connection.
*
This is a higher-level USBmuxTCP-type functio
n.
*
@note Once a connection is closed it may not be used agai
n.
*
*
* @param phone The iPhone to close a connection with.
* @param connection The connection to close.
* @param connection The connection to close.
* @return Doesn't return anything; WILL FREE THE CONNECTION'S MEMORY!!!
*/
*/
void
mux_close_connection
(
usbmux_connection
*
connection
)
{
void
mux_close_connection
(
usbmux_connection
*
connection
)
{
if
(
!
connection
||
!
connection
->
phone
)
return
;
if
(
!
connection
||
!
connection
->
phone
)
return
;
...
@@ -171,13 +177,12 @@ void mux_close_connection(usbmux_connection *connection) {
...
@@ -171,13 +177,12 @@ void mux_close_connection(usbmux_connection *connection) {
delete_connection
(
connection
);
delete_connection
(
connection
);
}
}
/*
/** Sends the given data over the selected connection.
* This is a higher-level USBMuxTCP-like function.
*
*
* @param phone The iPhone to send to.
* @param connection The connection we're sending data on.
* @param connection The connection we're sending data on.
* @param data A pointer to the data to send.
* @param data A pointer to the data to send.
* @param datalen How much data we're sending.
* @param datalen How much data we're sending.
*
* @return The number of bytes sent, minus the header (28), or -1 on error.
* @return The number of bytes sent, minus the header (28), or -1 on error.
*/
*/
int
mux_send
(
usbmux_connection
*
connection
,
const
char
*
data
,
uint32
datalen
)
{
int
mux_send
(
usbmux_connection
*
connection
,
const
char
*
data
,
uint32
datalen
)
{
...
@@ -231,16 +236,14 @@ int mux_send(usbmux_connection *connection, const char *data, uint32 datalen) {
...
@@ -231,16 +236,14 @@ int mux_send(usbmux_connection *connection, const char *data, uint32 datalen) {
return
bytes
;
// or something
return
bytes
;
// or something
}
}
/**
/** This is a higher-level USBMuxTCP-like function
* This is a higher-level USBMuxTCP-like function
*
*
* @param phone The phone to receive data from.
* @param connection The connection to receive data on.
* @param connection The connection to receive data on.
* @param data Where to put the data we receive.
* @param data Where to put the data we receive.
* @param datalen How much data to read.
* @param datalen How much data to read.
* @returns How many bytes were read, or -1 if something bad happens.
*
* @return How many bytes were read, or -1 if something bad happens.
*/
*/
int
mux_recv
(
usbmux_connection
*
connection
,
char
*
data
,
uint32
datalen
)
{
int
mux_recv
(
usbmux_connection
*
connection
,
char
*
data
,
uint32
datalen
)
{
/*
/*
* Order of operation:
* Order of operation:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment