@@ -15,6 +15,7 @@ use crate::IdeviceError;
1515pub enum XPCFlag {
1616 AlwaysSet ,
1717 DataFlag ,
18+ Reply ,
1819 WantingReply ,
1920 InitHandshake ,
2021
@@ -29,6 +30,7 @@ impl From<XPCFlag> for u32 {
2930 match value {
3031 XPCFlag :: AlwaysSet => 0x00000001 ,
3132 XPCFlag :: DataFlag => 0x00000100 ,
33+ XPCFlag :: Reply => 0x00020000 ,
3234 XPCFlag :: WantingReply => 0x00010000 ,
3335 XPCFlag :: InitHandshake => 0x00400000 ,
3436 XPCFlag :: FileTxStreamRequest => 0x00100000 ,
@@ -60,6 +62,7 @@ impl PartialEq for XPCFlag {
6062
6163#[ repr( u32 ) ]
6264pub enum XPCType {
65+ Null = 0x00001000 ,
6366 Bool = 0x00002000 ,
6467 Dictionary = 0x0000f000 ,
6568 Array = 0x0000e000 ,
@@ -81,6 +84,7 @@ impl TryFrom<u32> for XPCType {
8184
8285 fn try_from ( value : u32 ) -> Result < Self , Self :: Error > {
8386 match value {
87+ 0x00001000 => Ok ( Self :: Null ) ,
8488 0x00002000 => Ok ( Self :: Bool ) ,
8589 0x0000f000 => Ok ( Self :: Dictionary ) ,
8690 0x0000e000 => Ok ( Self :: Array ) ,
@@ -101,6 +105,7 @@ pub type Dictionary = IndexMap<String, XPCObject>;
101105
102106#[ derive( Debug , Clone , Serialize , Deserialize , PartialEq ) ]
103107pub enum XPCObject {
108+ Null ,
104109 Bool ( bool ) ,
105110 Dictionary ( Dictionary ) ,
106111 Array ( Vec < XPCObject > ) ,
@@ -146,6 +151,7 @@ impl From<plist::Value> for XPCObject {
146151impl XPCObject {
147152 pub fn to_plist ( & self ) -> plist:: Value {
148153 match self {
154+ Self :: Null => plist:: Value :: String ( "" . into ( ) ) ,
149155 Self :: Bool ( v) => plist:: Value :: Boolean ( * v) ,
150156 Self :: Uuid ( uuid) => plist:: Value :: String ( uuid. to_string ( ) ) ,
151157 Self :: Double ( f) => plist:: Value :: Real ( * f) ,
@@ -181,6 +187,7 @@ impl XPCObject {
181187
182188 fn encode_object ( & self , buf : & mut Vec < u8 > ) -> Result < ( ) , IdeviceError > {
183189 match self {
190+ XPCObject :: Null => buf. extend_from_slice ( & ( XPCType :: Null as u32 ) . to_le_bytes ( ) ) ,
184191 XPCObject :: Bool ( val) => {
185192 buf. extend_from_slice ( & ( XPCType :: Bool as u32 ) . to_le_bytes ( ) ) ;
186193 buf. push ( if * val { 1 } else { 0 } ) ;
@@ -288,6 +295,7 @@ impl XPCObject {
288295 let xpc_type = u32:: from_le_bytes ( buf_32) ;
289296 let xpc_type: XPCType = xpc_type. try_into ( ) ?;
290297 match xpc_type {
298+ XPCType :: Null => Ok ( XPCObject :: Null ) ,
291299 XPCType :: Dictionary => {
292300 let mut ret = IndexMap :: new ( ) ;
293301
@@ -559,12 +567,15 @@ impl std::fmt::Debug for XPCMessage {
559567 if self . flags & 0x00010000 != 0 {
560568 parts. push ( "WantingReply" . to_string ( ) ) ;
561569 }
570+ if self . flags & 0x00020000 != 0 {
571+ parts. push ( "Reply" . to_string ( ) ) ;
572+ }
562573 if self . flags & 0x00400000 != 0 {
563574 parts. push ( "InitHandshake" . to_string ( ) ) ;
564575 }
565576
566577 // Check for any unknown bits (not covered by known flags)
567- let known_mask = 0x00000001 | 0x00000100 | 0x00010000 | 0x00400000 ;
578+ let known_mask = 0x00000001 | 0x00000100 | 0x00010000 | 0x00020000 | 0x00400000 ;
568579 let custom_bits = self . flags & !known_mask;
569580 if custom_bits != 0 {
570581 parts. push ( format ! ( "Custom(0x{custom_bits:08X})" ) ) ;
0 commit comments