1*fdd8201dSApple OSS Distributions /* 2*fdd8201dSApple OSS Distributions * Copyright (c) 2019 Apple Inc. All rights reserved. 3*fdd8201dSApple OSS Distributions * 4*fdd8201dSApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5*fdd8201dSApple OSS Distributions * 6*fdd8201dSApple OSS Distributions * This file contains Original Code and/or Modifications of Original Code 7*fdd8201dSApple OSS Distributions * as defined in and that are subject to the Apple Public Source License 8*fdd8201dSApple OSS Distributions * Version 2.0 (the 'License'). You may not use this file except in 9*fdd8201dSApple OSS Distributions * compliance with the License. The rights granted to you under the License 10*fdd8201dSApple OSS Distributions * may not be used to create, or enable the creation or redistribution of, 11*fdd8201dSApple OSS Distributions * unlawful or unlicensed copies of an Apple operating system, or to 12*fdd8201dSApple OSS Distributions * circumvent, violate, or enable the circumvention or violation of, any 13*fdd8201dSApple OSS Distributions * terms of an Apple operating system software license agreement. 14*fdd8201dSApple OSS Distributions * 15*fdd8201dSApple OSS Distributions * Please obtain a copy of the License at 16*fdd8201dSApple OSS Distributions * http://www.opensource.apple.com/apsl/ and read it before using this file. 17*fdd8201dSApple OSS Distributions * 18*fdd8201dSApple OSS Distributions * The Original Code and all software distributed under the License are 19*fdd8201dSApple OSS Distributions * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20*fdd8201dSApple OSS Distributions * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21*fdd8201dSApple OSS Distributions * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22*fdd8201dSApple OSS Distributions * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23*fdd8201dSApple OSS Distributions * Please see the License for the specific language governing rights and 24*fdd8201dSApple OSS Distributions * limitations under the License. 25*fdd8201dSApple OSS Distributions * 26*fdd8201dSApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27*fdd8201dSApple OSS Distributions */ 28*fdd8201dSApple OSS Distributions 29*fdd8201dSApple OSS Distributions #ifndef _NET_MULTI_LAYER_PKT_LOG_H_ 30*fdd8201dSApple OSS Distributions #define _NET_MULTI_LAYER_PKT_LOG_H_ 31*fdd8201dSApple OSS Distributions 32*fdd8201dSApple OSS Distributions #include <os/log.h> 33*fdd8201dSApple OSS Distributions 34*fdd8201dSApple OSS Distributions /* 35*fdd8201dSApple OSS Distributions * Bump this version whenever the format of a log is modified 36*fdd8201dSApple OSS Distributions */ 37*fdd8201dSApple OSS Distributions #define MPKL_VERSION 1 38*fdd8201dSApple OSS Distributions 39*fdd8201dSApple OSS Distributions /* 40*fdd8201dSApple OSS Distributions * Protocol ID, use to track inter-layer transitions and direction of data flow. 41*fdd8201dSApple OSS Distributions * Watch transport physical layer has lowest numeric value, increases to the highest layer in the system. 42*fdd8201dSApple OSS Distributions * Direction is to physical layer, or away from physical layer. 43*fdd8201dSApple OSS Distributions * 44*fdd8201dSApple OSS Distributions */ 45*fdd8201dSApple OSS Distributions 46*fdd8201dSApple OSS Distributions #define MPKL_PROTOCOL_PHYSICAL ((uint8_t)0) /* (OTA/serial-port/etc..) */ 47*fdd8201dSApple OSS Distributions 48*fdd8201dSApple OSS Distributions #define MPKL_PROTOCOL_BT ((uint8_t)20) 49*fdd8201dSApple OSS Distributions #define MPKL_PROTOCOL_WIFI ((uint8_t)30) 50*fdd8201dSApple OSS Distributions #define MPKL_PROTOCOL_CELLULAR ((uint8_t)40) 51*fdd8201dSApple OSS Distributions #define MPKL_PROTOCOL_TERMINUS ((uint8_t)60) 52*fdd8201dSApple OSS Distributions #define MPKL_PROTOCOL_IPSEC ((uint8_t)80) 53*fdd8201dSApple OSS Distributions #define MPKL_PROTOCOL_TCP ((uint8_t)100) 54*fdd8201dSApple OSS Distributions #define MPKL_PROTOCOL_IDS ((uint8_t)120) 55*fdd8201dSApple OSS Distributions #define MPKL_PROTOCOL_LIBNETCORE ((uint8_t)140) 56*fdd8201dSApple OSS Distributions #define MPKL_PROTOCOL_CFNETWORK ((uint8_t)160) 57*fdd8201dSApple OSS Distributions #define MPKL_PROTOCOL_REMOTE_CONNECTION ((uint8_t)200) 58*fdd8201dSApple OSS Distributions 59*fdd8201dSApple OSS Distributions #define MPKL_TOPMOST_LAYER ((uint8_t)255) /* Top-most layer */ 60*fdd8201dSApple OSS Distributions 61*fdd8201dSApple OSS Distributions 62*fdd8201dSApple OSS Distributions /*! 63*fdd8201dSApple OSS Distributions * @macro MPKL_CREATE_LOGOBJECT 64*fdd8201dSApple OSS Distributions * @discussion Creates a log object with input category name for the transportpacketlog subsystem 65*fdd8201dSApple OSS Distributions * 66*fdd8201dSApple OSS Distributions * @param Name string name of os_log_t category 67*fdd8201dSApple OSS Distributions * 68*fdd8201dSApple OSS Distributions * @return os_log_t object 69*fdd8201dSApple OSS Distributions * 70*fdd8201dSApple OSS Distributions */ 71*fdd8201dSApple OSS Distributions #define MPKL_CREATE_LOGOBJECT(Name) os_log_create("com.apple.magnetpacketlog", Name) 72*fdd8201dSApple OSS Distributions 73*fdd8201dSApple OSS Distributions /* 74*fdd8201dSApple OSS Distributions * Cross-layer association APIs 75*fdd8201dSApple OSS Distributions * 76*fdd8201dSApple OSS Distributions */ 77*fdd8201dSApple OSS Distributions 78*fdd8201dSApple OSS Distributions /*! 79*fdd8201dSApple OSS Distributions * @macro MPKL_UUID_UUID_ASSOCIATE_PREV 80*fdd8201dSApple OSS Distributions * @discussion Associate current layer's packet UUID to previous layer's packet UUID, data is flowing into the current layer 81*fdd8201dSApple OSS Distributions * 82*fdd8201dSApple OSS Distributions * @param LOGOBJECT os_log_t object to write data into 83*fdd8201dSApple OSS Distributions * @param CUR_PROTOCOL_ID uint8_t ID of current layer from MPKL_PROTOCOL_XXX defines above 84*fdd8201dSApple OSS Distributions * @param PREV_PROTOCOL_ID uint8_t ID of previous layer being associated 85*fdd8201dSApple OSS Distributions * @param CUR_UUID uuid_t Current layer 16-byte UUID of packet 86*fdd8201dSApple OSS Distributions * @param PREV_UUID uuid_t Previous layer 16-byte UUID of packet 87*fdd8201dSApple OSS Distributions * @param CUR_LEN uint16_t Current layer packet length 88*fdd8201dSApple OSS Distributions * @param LOG_SEQ uint8_t Incrementing sequence number to detect logging system drop of messages 89*fdd8201dSApple OSS Distributions */ 90*fdd8201dSApple OSS Distributions 91*fdd8201dSApple OSS Distributions #define MPKL_UUID_UUID_ASSOCIATE_PREV(LOGOBJECT, CUR_PROTOCOL_ID, PREV_PROTOCOL_ID, CUR_UUID, PREV_UUID, CUR_LEN, LOG_SEQN) \ 92*fdd8201dSApple OSS Distributions os_log(LOGOBJECT, "1 {curProtocol: %hhu, prevProtocol: %hhu, curUUID: %{public,uuid_t}.16P, prevUUID: %{public,uuid_t}.16P, curPktLen: %hu, logSeqn: %hhu}", CUR_PROTOCOL_ID, PREV_PROTOCOL_ID, CUR_UUID, PREV_UUID, CUR_LEN, LOG_SEQN) 93*fdd8201dSApple OSS Distributions 94*fdd8201dSApple OSS Distributions /*! 95*fdd8201dSApple OSS Distributions * @macro MPKL_UUID_UUID_ASSOCIATE_NEXT 96*fdd8201dSApple OSS Distributions * @discussion Associate current layer's packet UUID to next layer's packet UUID, data is flowing out of the current layer 97*fdd8201dSApple OSS Distributions * 98*fdd8201dSApple OSS Distributions * @param LOGOBJECT os_log_t object to write data into 99*fdd8201dSApple OSS Distributions * @param LABEL string optional layer-specific label for readability/debugability, this is ignored by the parser. Can not contain {} 100*fdd8201dSApple OSS Distributions * @param CUR_PROTOCOL_ID uint8_t ID of current layer from MPKL_PROTOCOL_XXX defines above 101*fdd8201dSApple OSS Distributions * @param NEXT_PROTOCOL_ID uint8_t ID of next layer being associated 102*fdd8201dSApple OSS Distributions * @param CUR_UUID uuid_t Current layer 16-byte UUID of packet 103*fdd8201dSApple OSS Distributions * @param NEXT_UUID uuid_t Next layer 16-byte UUID of packet 104*fdd8201dSApple OSS Distributions * @param CUR_LEN uint16_t Current layer packet length 105*fdd8201dSApple OSS Distributions * @param LOG_SEQ uint8_t Incrementing sequence number to detect logging system drop of messages 106*fdd8201dSApple OSS Distributions */ 107*fdd8201dSApple OSS Distributions 108*fdd8201dSApple OSS Distributions #define MPKL_UUID_UUID_ASSOCIATE_NEXT(LOGOBJECT, CUR_PROTOCOL_ID, NEXT_PROTOCOL_ID, CUR_UUID, NEXT_UUID, CUR_LEN, LOG_SEQN) \ 109*fdd8201dSApple OSS Distributions os_log(LOGOBJECT, "2 {curProtocol: %hhu, nextProtocol: %hhu, curUUID: %{public,uuid_t}.16P, nextUUID: %{public,uuid_t}.16P, curPktLen: %hu, logSeqn: %hhu}", CUR_PROTOCOL_ID, NEXT_PROTOCOL_ID, CUR_UUID, NEXT_UUID, CUR_LEN, LOG_SEQN) 110*fdd8201dSApple OSS Distributions 111*fdd8201dSApple OSS Distributions /*! 112*fdd8201dSApple OSS Distributions * @macro MPKL_SEQRANGE_UUID_ASSOCIATE 113*fdd8201dSApple OSS Distributions * @discussion Associate previous layer's byte sequence range (start/end) to current layer's packet UUID 114*fdd8201dSApple OSS Distributions * 115*fdd8201dSApple OSS Distributions * @param LOGOBJECT os_log_t object to write data into 116*fdd8201dSApple OSS Distributions * @param LABEL string optional layer-specific label for readability/debugability, this is ignored by the parser. Can not contain {} 117*fdd8201dSApple OSS Distributions * @param CUR_PROTOCOL_ID uint8_t ID of current layer from MPKL_PROTOCOL_XXX defines above 118*fdd8201dSApple OSS Distributions * @param PREV_PROTOCOL_ID uint8_t ID of other layer being associated 119*fdd8201dSApple OSS Distributions * @param PREV_RANGE_START uint32_t Previous layer byte sequence range start 120*fdd8201dSApple OSS Distributions * @param PREV_RANGE_END uint32_t Previous layer byte sequence range end 121*fdd8201dSApple OSS Distributions * @param CUR_UUID uuid_t Other layer 16-byte UUID of packet 122*fdd8201dSApple OSS Distributions * @param CUR_LEN uint16_t Current layer packet length 123*fdd8201dSApple OSS Distributions * @param LOG_SEQN uint8_t Incrementing sequence number to detect logging system drop of messages 124*fdd8201dSApple OSS Distributions */ 125*fdd8201dSApple OSS Distributions 126*fdd8201dSApple OSS Distributions #define MPKL_SEQRANGE_UUID_ASSOCIATE(LOGOBJECT, CUR_PROTOCOL_ID, PREV_PROTOCOL_ID, PREV_RANGE_START, PREV_RANGE_END, CUR_UUID, CUR_LEN, LOG_SEQN) \ 127*fdd8201dSApple OSS Distributions os_log(LOGOBJECT, "3 {curProtocol: %hhu, prevProtocol: %hhu, prevStart: %u, prevEnd: %u, curUUID: %{public,uuid_t}.16P, curPktLen: %hu, logSeqn: %hhu}", CUR_PROTOCOL_ID, PREV_PROTOCOL_ID, PREV_RANGE_START, PREV_RANGE_END, CUR_UUID, CUR_LEN, LOG_SEQN) 128*fdd8201dSApple OSS Distributions 129*fdd8201dSApple OSS Distributions /*! 130*fdd8201dSApple OSS Distributions * @macro MPKL_UUID_SEQRANGE_ASSOCIATE 131*fdd8201dSApple OSS Distributions * @discussion Associate previous layer's packet UUID to current layer's byte sequence range (start/end) 132*fdd8201dSApple OSS Distributions * 133*fdd8201dSApple OSS Distributions * @param LOGOBJECT os_log_t object to write data into 134*fdd8201dSApple OSS Distributions * @param LABEL string optional layer-specific label for readability/debugability, this is ignored by the parser. Can not contain {} 135*fdd8201dSApple OSS Distributions * @param CUR_PROTOCOL_ID uint8_t ID of current layer from MPKL_PROTOCOL_XXX defines above 136*fdd8201dSApple OSS Distributions * @param PREV_PROTOCOL_ID uint8_t ID of other layer being associated 137*fdd8201dSApple OSS Distributions * @param PREV_UUID uuid_t Previous layer 16-byte UUID of packet 138*fdd8201dSApple OSS Distributions * @param CUR_RANGE_START uint16_t Current layer byte sequence range start 139*fdd8201dSApple OSS Distributions * @param CUR_RANGE_END uint16_t Current layer byte sequence range end 140*fdd8201dSApple OSS Distributions * @param PREV_LEN uint16_t PRevious layer message length 141*fdd8201dSApple OSS Distributions * @param LOG_SEQN uint8_t Incrementing sequence number to detect logging system drop of messages 142*fdd8201dSApple OSS Distributions */ 143*fdd8201dSApple OSS Distributions 144*fdd8201dSApple OSS Distributions #define MPKL_UUID_SEQRANGE_ASSOCIATE(LOGOBJECT, CUR_PROTOCOL_ID, PREV_PROTOCOL_ID, PREV_UUID, CUR_RANGE_START, CUR_RANGE_END, PREV_LEN, LOG_SEQN) \ 145*fdd8201dSApple OSS Distributions os_log(LOGOBJECT, "4 {curProtocol: %hhu, prevProtocol: %hhu, prevUUID: %{public,uuid_t}.16P, curStart: %u, curEnd: %u, prevPktLen: %hu, logSeqn: %hhu}", CUR_PROTOCOL_ID, PREV_PROTOCOL_ID, PREV_UUID, CUR_RANGE_START, CUR_RANGE_END, PREV_LEN, LOG_SEQN) 146*fdd8201dSApple OSS Distributions 147*fdd8201dSApple OSS Distributions 148*fdd8201dSApple OSS Distributions /*! 149*fdd8201dSApple OSS Distributions * @macro MPKL_BUNDLEID_UUID_ASSOCIATE 150*fdd8201dSApple OSS Distributions * @discussion Associate previous layer's packet BUNDLEID to current layer's UUID 151*fdd8201dSApple OSS Distributions * 152*fdd8201dSApple OSS Distributions * @param LOGOBJECT os_log_t object to write data into 153*fdd8201dSApple OSS Distributions * @param LABEL string optional layer-specific label for readability/debugability, this is ignored by the parser. Can not contain {} 154*fdd8201dSApple OSS Distributions * @param CUR_PROTOCOL_ID uint8_t ID of current layer from MPKL_PROTOCOL_XXX defines above 155*fdd8201dSApple OSS Distributions * @param PREV_PROTOCOL_ID uint8_t ID of other layer being associated 156*fdd8201dSApple OSS Distributions * @param PREV_BUNDLE_ID NSString BundleID of previous layer 157*fdd8201dSApple OSS Distributions * @param CUR_UUID uuid_t Current layer 16-byte UUID of packet 158*fdd8201dSApple OSS Distributions * @param CUR_LEN uint32_t Current layer packet length 159*fdd8201dSApple OSS Distributions * @param LOG_SEQ uint8_t Incrementing sequence number to detect logging system drop of messages 160*fdd8201dSApple OSS Distributions */ 161*fdd8201dSApple OSS Distributions 162*fdd8201dSApple OSS Distributions #define MPKL_BUNDLEID_UUID_ASSOCIATE(LOGOBJECT, CUR_PROTOCOL_ID, PREV_PROTOCOL_ID, PREV_BUNDLE_ID, CUR_UUID, CUR_LEN, LOG_SEQN) \ 163*fdd8201dSApple OSS Distributions os_log(LOGOBJECT, "5 {curProtocol: %hhu, prevProtocol: %hhu, prevBundleID: %@, curUUID: %{public,uuid_t}.16P, curPktLen: %u, logSeqn: %hhu}", CUR_PROTOCOL_ID, PREV_PROTOCOL_ID, PREV_BUNDLE_ID, CUR_UUID, CUR_LEN, LOG_SEQN) 164*fdd8201dSApple OSS Distributions 165*fdd8201dSApple OSS Distributions 166*fdd8201dSApple OSS Distributions /*! 167*fdd8201dSApple OSS Distributions * @macro MPKL_SEQRANGE_UUID_ASSOCIATE_W_BUNDLEID 168*fdd8201dSApple OSS Distributions * @discussion Associate previous layer's packet byte sequence range to to current layer's UUID and client's bundle id 169*fdd8201dSApple OSS Distributions * 170*fdd8201dSApple OSS Distributions * @param LOGOBJECT os_log_t object to write data into 171*fdd8201dSApple OSS Distributions * @param LABEL string optional layer-specific label for readability/debugability, this is ignored by the parser. Can not contain {} 172*fdd8201dSApple OSS Distributions * @param CUR_PROTOCOL_ID uint8_t ID of current layer from MPKL_PROTOCOL_XXX defines above 173*fdd8201dSApple OSS Distributions * @param PREV_PROTOCOL_ID uint8_t ID of other layer being associated 174*fdd8201dSApple OSS Distributions * @param PREV_RANGE_START uint32_t Previous layer byte sequence range start 175*fdd8201dSApple OSS Distributions * @param PREV_RANGE_END uint32_t Previous layer byte sequence range end 176*fdd8201dSApple OSS Distributions * @param CUR_UUID uuid_t Current layer 16-byte UUID of packet 177*fdd8201dSApple OSS Distributions * @param PREV_BUNDLE_ID NSString BundleID of previous layer 178*fdd8201dSApple OSS Distributions * @param CUR_LEN uint16_t Current layer packet length 179*fdd8201dSApple OSS Distributions * @param LOG_SEQ uint8_t Incrementing sequence number to detect logging system drop of messages 180*fdd8201dSApple OSS Distributions */ 181*fdd8201dSApple OSS Distributions 182*fdd8201dSApple OSS Distributions #define MPKL_SEQRANGE_UUID_ASSOCIATE_W_BUNDLEID(LOGOBJECT, CUR_PROTOCOL_ID, PREV_PROTOCOL_ID, PREV_RANGE_START, PREV_RANGE_END, CUR_UUID, CLIENT_BUNDLE_ID, CUR_LEN, LOG_SEQN) \ 183*fdd8201dSApple OSS Distributions os_log(LOGOBJECT, "6 {curProtocol: %hhu, prevProtocol: %hhu, prevStart: %u, prevEnd: %u, curUUID: %{public,uuid_t}.16P, curBundleID: %@, curPktLen: %hu, logSeqn: %hhu}", CUR_PROTOCOL_ID, PREV_PROTOCOL_ID, PREV_RANGE_START, PREV_RANGE_END, CUR_UUID, CLIENT_BUNDLE_ID, CUR_LEN, LOG_SEQN) 184*fdd8201dSApple OSS Distributions 185*fdd8201dSApple OSS Distributions 186*fdd8201dSApple OSS Distributions /*! 187*fdd8201dSApple OSS Distributions * @macro MPKL_SEQN_UUID_ASSOCIATE_PREV 188*fdd8201dSApple OSS Distributions * @discussion Associate current layer's packet unique protocol sequenceNumber to another layer's message UUID 189*fdd8201dSApple OSS Distributions * Support fragmentation and re-assembly (for layers like BT), map byte-sequence range (2 byte) of current and other layer data 190*fdd8201dSApple OSS Distributions * 191*fdd8201dSApple OSS Distributions * @param LOGOBJECT os_log_t object to write data into 192*fdd8201dSApple OSS Distributions * @param LABEL string optional layer-specific label for readability/debugability, this is ignored by the parser. Can not contain {} 193*fdd8201dSApple OSS Distributions * @param CUR_PROTOCOL_ID uint8_t ID of current layer from MPKL_PROTOCOL_XXX defines above 194*fdd8201dSApple OSS Distributions * @param PREV_PROTOCOL_ID uint8_t ID of other layer being associated 195*fdd8201dSApple OSS Distributions * @param PREV_UUID uuid_t Other layer 16-byte UUID of message 196*fdd8201dSApple OSS Distributions * @param PREV_RANGE_START uint16_t Current layer byte sequence range start 197*fdd8201dSApple OSS Distributions * @param PREV_RANGE_END uint16_t Current layer byte sequence range end 198*fdd8201dSApple OSS Distributions * @param PREV_LEN uint16_t PRevious layer message length 199*fdd8201dSApple OSS Distributions * @param CUR_SEQ_N uint16_t Current layer message length 200*fdd8201dSApple OSS Distributions * @param CUR_RANGE_START uint16_t Current layer byte sequence range start 201*fdd8201dSApple OSS Distributions * @param CUR_RANGE_END uint16_t Current layer byte sequence range end 202*fdd8201dSApple OSS Distributions * @param LOG_SEQN uint8_t Incrementing sequence number to detect logging system drop of messages 203*fdd8201dSApple OSS Distributions */ 204*fdd8201dSApple OSS Distributions 205*fdd8201dSApple OSS Distributions #define MPKL_SEQN_UUID_ASSOCIATE_PREV(LOGOBJECT, CUR_PROTOCOL_ID, PREV_PROTOCOL_ID, PREV_UUID, PREV_RANGE_START, PREV_RANGE_END, PREV_LEN, CUR_SEQ_N, CUR_RANGE_START, CUR_RANGE_END, LOG_SEQN) \ 206*fdd8201dSApple OSS Distributions os_log(LOGOBJECT, "7 {Send, curProtocol: %hhu, prevProtocol: %hhu, prevUUID: %{public,uuid_t}.16P, prevStart: %hu, prevEnd: %hu, prevPktLen %hu, curSeqN: %hu, curStart: %hu, curEnd: %hu, logSeqn: %hhu}", CUR_PROTOCOL_ID, PREV_PROTOCOL_ID, PREV_UUID, PREV_RANGE_START, PREV_RANGE_END, PREV_LEN, CUR_SEQ_N, CUR_RANGE_START, CUR_RANGE_END, LOG_SEQN) 207*fdd8201dSApple OSS Distributions 208*fdd8201dSApple OSS Distributions /*! 209*fdd8201dSApple OSS Distributions * @macro MPKL_SEQN_UUID_ASSOCIATE_NEXT 210*fdd8201dSApple OSS Distributions * @discussion Associate current layer's packet unique protocol sequenceNumber to another layer's message UUID 211*fdd8201dSApple OSS Distributions * Support fragmentation and re-assembly (for layers like BT), map byte-sequence range (2 byte) of current and other layer data 212*fdd8201dSApple OSS Distributions * 213*fdd8201dSApple OSS Distributions * @param LOGOBJECT os_log_t object to write data into 214*fdd8201dSApple OSS Distributions * @param LABEL string optional layer-specific label for readability/debugability, this is ignored by the parser. Can not contain {} 215*fdd8201dSApple OSS Distributions * @param CUR_PROTOCOL_ID uint8_t ID of current layer from MPKL_PROTOCOL_XXX defines above 216*fdd8201dSApple OSS Distributions * @param NEXT_PROTOCOL_ID uint8_t ID of other layer being associated 217*fdd8201dSApple OSS Distributions * @param NEXT_UUID uuid_t Other layer 16-byte UUID of message 218*fdd8201dSApple OSS Distributions * @param NEXT_RANGE_START uint16_t Current layer byte sequence range start 219*fdd8201dSApple OSS Distributions * @param NEXT_RANGE_END uint16_t Current layer byte sequence range end 220*fdd8201dSApple OSS Distributions * @param NEXT_LEN uint16_t Current layer message length 221*fdd8201dSApple OSS Distributions * @param CUR_SEQ_N uint16_t Current layer message length 222*fdd8201dSApple OSS Distributions * @param CUR_RANGE_START uint16_t Current layer byte sequence range start 223*fdd8201dSApple OSS Distributions * @param CUR_RANGE_END uint16_t Current layer byte sequence range end 224*fdd8201dSApple OSS Distributions * @param LOG_SEQN uint8_t Incrementing sequence number to detect logging system drop of messages 225*fdd8201dSApple OSS Distributions */ 226*fdd8201dSApple OSS Distributions 227*fdd8201dSApple OSS Distributions #define MPKL_SEQN_UUID_ASSOCIATE_NEXT(LOGOBJECT, CUR_PROTOCOL_ID, NEXT_PROTOCOL_ID, NEXT_UUID, NEXT_RANGE_START, NEXT_RANGE_END, NEXT_LEN, CUR_SEQ_N, CUR_RANGE_START, CUR_RANGE_END, LOG_SEQN) \ 228*fdd8201dSApple OSS Distributions os_log(LOGOBJECT, "8 {Receive, curProtocol: %hhu, nextProtocol: %hhu, nextUUID: %{public,uuid_t}.16P, nextStart: %hu, nextEnd: %hu, nextPktLen %hu, curSeqN: %hu, curStart: %hu, curEnd: %hu, logSeqn: %hhu}", CUR_PROTOCOL_ID, NEXT_PROTOCOL_ID, NEXT_UUID, NEXT_RANGE_START, NEXT_RANGE_END, NEXT_LEN, CUR_SEQ_N, CUR_RANGE_START, CUR_RANGE_END, LOG_SEQN) 229*fdd8201dSApple OSS Distributions 230*fdd8201dSApple OSS Distributions /* 231*fdd8201dSApple OSS Distributions * APIs to indicate transitioning of messages; example in/out of a layer 232*fdd8201dSApple OSS Distributions */ 233*fdd8201dSApple OSS Distributions 234*fdd8201dSApple OSS Distributions /*! 235*fdd8201dSApple OSS Distributions * @macro MPKL_UUID_NEXT 236*fdd8201dSApple OSS Distributions * @discussion Log the transition of current layer's message with UUID to next layer 237*fdd8201dSApple OSS Distributions * 238*fdd8201dSApple OSS Distributions * @param LOGOBJECT os_log_t object to write data into 239*fdd8201dSApple OSS Distributions * @param LABEL string optional layer-specific label for readability/debugability, this is ignored by the parser. Can not contain {} 240*fdd8201dSApple OSS Distributions * @param CUR_PROTOCOL_ID uint8_t ID of current layer from MPKL_PROTOCOL_XXX defines above 241*fdd8201dSApple OSS Distributions * @param NEXT_PROTOCOL_ID uint8_t ID of next layer 242*fdd8201dSApple OSS Distributions * @param CUR_UUID uuid_t Current layer 16-byte UUID of message 243*fdd8201dSApple OSS Distributions * @param CUR_LEN uint32_t Current layer message length 244*fdd8201dSApple OSS Distributions * @param LOG_SEQN uint8_t Incrementing sequence number to detect logging system drop of messages 245*fdd8201dSApple OSS Distributions */ 246*fdd8201dSApple OSS Distributions 247*fdd8201dSApple OSS Distributions #define MPKL_UUID_NEXT(LOGOBJECT, CUR_PROTOCOL_ID, NEXT_PROTOCOL_ID, CUR_UUID, CUR_LEN, LOG_SEQN) \ 248*fdd8201dSApple OSS Distributions os_log(LOGOBJECT, "9 {curProtocol: %hhu, nextProtocol: %hhu, curUUID: %{public,uuid_t}.16P, curPktLen: %u, logSeqn: %hhu}", CUR_PROTOCOL_ID, NEXT_PROTOCOL_ID, CUR_UUID, CUR_LEN, LOG_SEQN) 249*fdd8201dSApple OSS Distributions 250*fdd8201dSApple OSS Distributions /*! 251*fdd8201dSApple OSS Distributions * @macro MPKL_SEQRANGE_NEXT 252*fdd8201dSApple OSS Distributions * @discussion Log the transition of current layer's message with UUID to next layer 253*fdd8201dSApple OSS Distributions * 254*fdd8201dSApple OSS Distributions * @param LOGOBJECT os_log_t object to write data into 255*fdd8201dSApple OSS Distributions * @param LABEL string optional layer-specific label for readability/debugability, this is ignored by the parser. Can not contain {} 256*fdd8201dSApple OSS Distributions * @param CUR_PROTOCOL_ID uint8_t ID of current layer from MPKL_PROTOCOL_XXX defines above 257*fdd8201dSApple OSS Distributions * @param NEXT_PROTOCOL_ID uint8_t ID of next layer 258*fdd8201dSApple OSS Distributions * @param CUR_RANGE_START uint16_t Current layer byte sequence range start 259*fdd8201dSApple OSS Distributions * @param CUR_RANGE_END uint16_t Current layer byte sequence range end 260*fdd8201dSApple OSS Distributions * @param LOG_SEQN uint8_t Incrementing sequence number to detect logging system drop of messages 261*fdd8201dSApple OSS Distributions */ 262*fdd8201dSApple OSS Distributions 263*fdd8201dSApple OSS Distributions #define MPKL_SEQRANGE_NEXT(LOGOBJECT, CUR_PROTOCOL_ID, NEXT_PROTOCOL_ID, CUR_UUID, CUR_LEN, LOG_SEQN) \ 264*fdd8201dSApple OSS Distributions os_log(LOGOBJECT, "10 {curProtocol: %hhu, nextProtocol: %hhu, curUUID: %{public,uuid_t}.16P, curPktLen: %hu, logSeqn: %hhu}", CUR_PROTOCOL_ID, NEXT_PROTOCOL_ID, CUR_UUID, CUR_LEN, LOG_SEQN) 265*fdd8201dSApple OSS Distributions 266*fdd8201dSApple OSS Distributions 267*fdd8201dSApple OSS Distributions /*! 268*fdd8201dSApple OSS Distributions * @macro MPKL_UUID_PREV 269*fdd8201dSApple OSS Distributions * @discussion Log the transition of previous layer's message with UUID to current layer 270*fdd8201dSApple OSS Distributions * 271*fdd8201dSApple OSS Distributions * @param LOGOBJECT os_log_t object to write data into 272*fdd8201dSApple OSS Distributions * @param LABEL string optional layer-specific label for readability/debugability, this is ignored by the parser. Can not contain {} 273*fdd8201dSApple OSS Distributions * @param CUR_PROTOCOL_ID uint8_t ID of current layer from MPKL_PROTOCOL_XXX defines above 274*fdd8201dSApple OSS Distributions * @param PREV_PROTOCOL_ID uint8_t ID of other layer being associated 275*fdd8201dSApple OSS Distributions * @param PREV_UUID uuid_t Previous layer 16-byte UUID of message 276*fdd8201dSApple OSS Distributions * @param PREV_LEN uint16_t Previous layer message length 277*fdd8201dSApple OSS Distributions * @param LOG_SEQN uint8_t Incrementing sequence number to detect logging system drop of messages 278*fdd8201dSApple OSS Distributions */ 279*fdd8201dSApple OSS Distributions 280*fdd8201dSApple OSS Distributions #define MPKL_UUID_PREV(LOGOBJECT, CUR_PROTOCOL_ID, PREV_PROTOCOL_ID, PREV_UUID, PREV_LEN, LOG_SEQN) \ 281*fdd8201dSApple OSS Distributions os_log(LOGOBJECT, "11 {curProtocol: %hhu, prevProtocol: %hhu, prevUUID: %{public,uuid_t}.16P, prevPktLen: %hu, logSeqn: %hhu}", CUR_PROTOCOL_ID, PREV_PROTOCOL_ID, PREV_UUID, PREV_LEN, LOG_SEQN) 282*fdd8201dSApple OSS Distributions 283*fdd8201dSApple OSS Distributions /* 284*fdd8201dSApple OSS Distributions * APIs to indicate a Task Start/End 285*fdd8201dSApple OSS Distributions */ 286*fdd8201dSApple OSS Distributions 287*fdd8201dSApple OSS Distributions /*! 288*fdd8201dSApple OSS Distributions * @macro MPKL_TASK_START 289*fdd8201dSApple OSS Distributions * @discussion Log the start of a task 290*fdd8201dSApple OSS Distributions * 291*fdd8201dSApple OSS Distributions * @param LOGOBJECT os_log_t object to write data into 292*fdd8201dSApple OSS Distributions * @param LABEL string optional layer-specific label for readability/debugability, this is ignored by the parser. Can not contain {} 293*fdd8201dSApple OSS Distributions * @param CLIENT_BUNDLE_ID NSString bundleID of the client 294*fdd8201dSApple OSS Distributions * @param TASK_UUID uuid_t 16-byte UUID of NSURL task 295*fdd8201dSApple OSS Distributions * @param CONN_UUID uuid_t 16-byte UUID of associated libnetcore connection 296*fdd8201dSApple OSS Distributions * @param LOG_SEQN uint8_t Incrementing sequence number to detect logging system drop of messages 297*fdd8201dSApple OSS Distributions */ 298*fdd8201dSApple OSS Distributions 299*fdd8201dSApple OSS Distributions #define MPKL_TASK_START(LOGOBJECT, CLIENT_BUNDLE_ID, TASK_UUID, CONN_UUID, LOG_SEQN) \ 300*fdd8201dSApple OSS Distributions os_log(LOGOBJECT, "12 {startBundleID: %@, taskUUID: %{public,uuid_t}.16P, connUUID: %{public,uuid_t}.16P, logSeqn: %hhu}", CLIENT_BUNDLE_ID, TASK_UUID, CONN_UUID, LOG_SEQN) 301*fdd8201dSApple OSS Distributions 302*fdd8201dSApple OSS Distributions /*! 303*fdd8201dSApple OSS Distributions * @macro MPKL_TASK_START 304*fdd8201dSApple OSS Distributions * @discussion Log the end of a task 305*fdd8201dSApple OSS Distributions * 306*fdd8201dSApple OSS Distributions * @param LOGOBJECT os_log_t object to write data into 307*fdd8201dSApple OSS Distributions * @param LABEL string optional layer-specific label for readability/debugability, this is ignored by the parser. Can not contain {} 308*fdd8201dSApple OSS Distributions * @param CLIENT_BUNDLE_ID NSString bundleID of the client 309*fdd8201dSApple OSS Distributions * @param TASK_UUID uuid_t 16-byte UUID of NSURL task 310*fdd8201dSApple OSS Distributions * @param CONN_UUID uuid_t 16-byte UUID of associated libnetcore connection 311*fdd8201dSApple OSS Distributions * @param LOG_SEQN uint8_t Incrementing sequence number to detect logging system drop of messages 312*fdd8201dSApple OSS Distributions */ 313*fdd8201dSApple OSS Distributions 314*fdd8201dSApple OSS Distributions #define MPKL_TASK_END(LOGOBJECT, CLIENT_BUNDLE_ID, TASK_UUID, CONN_UUID, LOG_SEQN) \ 315*fdd8201dSApple OSS Distributions os_log(LOGOBJECT, "13 {endBundleID: %@, taskUUID: %{public,uuid_t}.16P, connUUID: %{public,uuid_t}.16P, logSeqn: %hhu}", CLIENT_BUNDLE_ID, TASK_UUID, CONN_UUID, LOG_SEQN) 316*fdd8201dSApple OSS Distributions 317*fdd8201dSApple OSS Distributions /*! 318*fdd8201dSApple OSS Distributions * @macro MPKL_SEQN_INCOMPLETE_PREV 319*fdd8201dSApple OSS Distributions * @discussion An incomplete packet was sent with a given protocol sequence number and couldn't be associated to another protocol. 320*fdd8201dSApple OSS Distributions * The incomplete packet is saved, its byte sequence range is logged and it is associated once more data arrives. 321*fdd8201dSApple OSS Distributions * 322*fdd8201dSApple OSS Distributions */ 323*fdd8201dSApple OSS Distributions 324*fdd8201dSApple OSS Distributions #define MPKL_SEQN_INCOMPLETE_PREV(LOGOBJECT, CUR_PROTOCOL_ID, PREV_PROTOCOL_ID, CUR_SEQ_N, CUR_RANGE_START, CUR_RANGE_END, PREV_RANGE_START, PREV_RANGE_END, LOG_SEQN) \ 325*fdd8201dSApple OSS Distributions os_log(LOGOBJECT, "14 {Send Incomplete. curProtocol: %hhu, prevProtocol: %hhu, curSeqN: %hu, curStart: %hu, curEnd: %hu, prevStart: %hu, prevEnd: %hu, logSeqn: %hhu}", CUR_PROTOCOL_ID, PREV_PROTOCOL_ID, CUR_SEQ_N, CUR_RANGE_START, CUR_RANGE_END, PREV_RANGE_START, PREV_RANGE_END, LOG_SEQN) 326*fdd8201dSApple OSS Distributions 327*fdd8201dSApple OSS Distributions /*! 328*fdd8201dSApple OSS Distributions * @macro MPKL_SEQN_INCOMPLETE_NEXT 329*fdd8201dSApple OSS Distributions * @discussion An incomplete packet was sent with a given protocol sequence number and couldn't be associated to another protocol. 330*fdd8201dSApple OSS Distributions * The incomplete packet is saved, its byte sequence range is logged and it is associated once more data arrives. 331*fdd8201dSApple OSS Distributions * 332*fdd8201dSApple OSS Distributions */ 333*fdd8201dSApple OSS Distributions 334*fdd8201dSApple OSS Distributions #define MPKL_SEQN_INCOMPLETE_NEXT(LOGOBJECT, CUR_PROTOCOL_ID, NEXT_PROTOCOL_ID, CUR_SEQ_N, CUR_RANGE_START, CUR_RANGE_END, NEXT_RANGE_START, NEXT_RANGE_END, LOG_SEQN) \ 335*fdd8201dSApple OSS Distributions os_log(LOGOBJECT, "15 {Receive Incomplete. curProtocol: %hhu, nextProtocol: %hhu, curSeqN: %hu, curStart: %hu, curEnd: %hu, nextStart: %hu, nextEnd: %hu, logSeqn: %hhu}", CUR_PROTOCOL_ID, NEXT_PROTOCOL_ID, CUR_SEQ_N, CUR_RANGE_START, CUR_RANGE_END, NEXT_RANGE_START, NEXT_RANGE_END, LOG_SEQN) 336*fdd8201dSApple OSS Distributions 337*fdd8201dSApple OSS Distributions #ifdef KERNEL 338*fdd8201dSApple OSS Distributions /*! 339*fdd8201dSApple OSS Distributions * @macro MPKL_TCP_SEND 340*fdd8201dSApple OSS Distributions * @discussion Associate data sent by a process with a TCP connection 341*fdd8201dSApple OSS Distributions * 342*fdd8201dSApple OSS Distributions * @param LOGOBJECT os_log_t object to write data into 343*fdd8201dSApple OSS Distributions * @param PREV_PROTOCOL_ID uint8_t Protocol identifier passed by the process (may be 0) 344*fdd8201dSApple OSS Distributions * @param PREV_UUID uuid_t UUID passed by the process (may be null UUID) 345*fdd8201dSApple OSS Distributions * @param LOCAL_PORT uint16_t Local port of the TCP connection 346*fdd8201dSApple OSS Distributions * @param REMOTE_PORT uint16_t Remote port of the TCP connection 347*fdd8201dSApple OSS Distributions * @param TCP_SEQ uint32_t TCP sequence number of the first byte of the data being sent by the process 348*fdd8201dSApple OSS Distributions * @param TCP_LEN uint32_t Length of the data 349*fdd8201dSApple OSS Distributions * @param PID uint16_t pid of the process using the TCP connection 350*fdd8201dSApple OSS Distributions * @param LOG_SEQN uint8_t Incrementing sequence number to detect logging system drop of messages 351*fdd8201dSApple OSS Distributions */ 352*fdd8201dSApple OSS Distributions #define MPKL_TCP_SEND(LOGOBJECT, PREV_PROTOCOL_ID, PREV_UUID, LOCAL_PORT, REMOTE_PORT, TCP_SEQ, TCP_LEN, PID, LOG_SEQN) \ 353*fdd8201dSApple OSS Distributions os_log_with_type(LOGOBJECT, net_mpklog_type, \ 354*fdd8201dSApple OSS Distributions "16 {curProtocol: 100, prevProtocol: %hhu, " \ 355*fdd8201dSApple OSS Distributions "prevUUID: " \ 356*fdd8201dSApple OSS Distributions "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X, " \ 357*fdd8201dSApple OSS Distributions "localPort: %hu, remotePort: %hu, tcpSeq: %u, length: %u, " \ 358*fdd8201dSApple OSS Distributions "pid: %hu, logSeqn: %hhu}", \ 359*fdd8201dSApple OSS Distributions PREV_PROTOCOL_ID, \ 360*fdd8201dSApple OSS Distributions PREV_UUID[0], PREV_UUID[1], PREV_UUID[2], PREV_UUID[3], PREV_UUID[4], PREV_UUID[5], PREV_UUID[6], PREV_UUID[7], \ 361*fdd8201dSApple OSS Distributions PREV_UUID[8], PREV_UUID[9], PREV_UUID[10], PREV_UUID[11], PREV_UUID[12], PREV_UUID[13], PREV_UUID[14], PREV_UUID[15], \ 362*fdd8201dSApple OSS Distributions LOCAL_PORT, REMOTE_PORT, TCP_SEQ, TCP_LEN, \ 363*fdd8201dSApple OSS Distributions (uint16_t)PID, LOG_SEQN) 364*fdd8201dSApple OSS Distributions 365*fdd8201dSApple OSS Distributions /*! 366*fdd8201dSApple OSS Distributions * @macro MPKL_TCP_INPUT 367*fdd8201dSApple OSS Distributions * @discussion Associate TCP segment being with a packet received to a TCP connection 368*fdd8201dSApple OSS Distributions * 369*fdd8201dSApple OSS Distributions * @param LOGOBJECT os_log_t object to write data into 370*fdd8201dSApple OSS Distributions * @param LOCAL_PORT uint16_t Local port in the TCP header of the segment 371*fdd8201dSApple OSS Distributions * @param REMOTE_PORT uint16_t Remote port in the TCP header of the segment 372*fdd8201dSApple OSS Distributions * @param TCP_SEQ uint32_t Sequence number in the TCP header of the segment 373*fdd8201dSApple OSS Distributions * @param TCP_ACK uint32_t Acknowledgement number in the TCP header of the segment 374*fdd8201dSApple OSS Distributions * @param TCP_LEN uint16_t Length in the TCP header of the segment 375*fdd8201dSApple OSS Distributions * @param TCP_FLAGS uint8_t Flags of the TCP header of the segment 376*fdd8201dSApple OSS Distributions * @param PID uint16_t pid of the process using the TCP connection 377*fdd8201dSApple OSS Distributions * @param LOG_SEQN uint8_t Incrementing sequence number to detect logging system drop of messages 378*fdd8201dSApple OSS Distributions */ 379*fdd8201dSApple OSS Distributions #define MPKL_TCP_INPUT(LOGOBJECT, LOCAL_PORT, REMOTE_PORT, TCP_SEQ, TCP_ACK, TCP_LEN, TCP_FLAGS, PID, LOG_SEQN) \ 380*fdd8201dSApple OSS Distributions os_log_with_type(LOGOBJECT, net_mpklog_type, \ 381*fdd8201dSApple OSS Distributions "17 {curProtocol: 100, prevProtocol: 80, " \ 382*fdd8201dSApple OSS Distributions "localPort: %hu, remotePort: %hu, tcpSeq: %u, tcpAck: %u, tcpLen: %hu, tcpFlags: 0x%02x, " \ 383*fdd8201dSApple OSS Distributions "pid: %hu, logSeqn: %hhu}", \ 384*fdd8201dSApple OSS Distributions LOCAL_PORT, REMOTE_PORT, TCP_SEQ, TCP_ACK, (uint16_t)TCP_LEN, TCP_FLAGS, \ 385*fdd8201dSApple OSS Distributions (uint16_t)PID, LOG_SEQN) 386*fdd8201dSApple OSS Distributions 387*fdd8201dSApple OSS Distributions /*! 388*fdd8201dSApple OSS Distributions * @macro MPKL_ESP_OUTPUT_TCP 389*fdd8201dSApple OSS Distributions * @discussion Associate a packet with a TCP segment being sent to an ESP packet 390*fdd8201dSApple OSS Distributions * 391*fdd8201dSApple OSS Distributions * @param LOGOBJECT os_log_t object to write data into 392*fdd8201dSApple OSS Distributions * @param SPI uint32_t SPI field in the ESP header 393*fdd8201dSApple OSS Distributions * @param ESP_SEQ uint32_t Sequence number field in the ESP header 394*fdd8201dSApple OSS Distributions * @param LOCAL_PORT uint16_t Local port of the TCP connection 395*fdd8201dSApple OSS Distributions * @param REMOTE_PORT uint16_t Remote port of the TCP connection 396*fdd8201dSApple OSS Distributions * @param TCP_SEQ uint32_t Sequence number in the TCP header of the segment 397*fdd8201dSApple OSS Distributions * @param TCP_ACK uint32_t Acknowledgement number in the TCP header of the segment 398*fdd8201dSApple OSS Distributions * @param TCP_LEN uint16_t Length in the TCP header of the segment 399*fdd8201dSApple OSS Distributions * @param TCP_FLAGS uint8_t Flags of the TCP header of the segment 400*fdd8201dSApple OSS Distributions */ 401*fdd8201dSApple OSS Distributions #define MPKL_ESP_OUTPUT_TCP(LOGOBJECT, SPI, ESP_SEQ, LOCAL_PORT, REMOTE_PORT, TCP_SEQ, TCP_ACK, TCP_LEN, TCP_FLAGS) \ 402*fdd8201dSApple OSS Distributions os_log_with_type(LOGOBJECT, (os_log_type_t)net_mpklog_type, \ 403*fdd8201dSApple OSS Distributions "18 {curProtocol: 80, spi: 0x%X, espSeq: %u, PayloadProtocol: 100, " \ 404*fdd8201dSApple OSS Distributions "localPort: %hu, remotePort: %hu, tcpSeq: %u, tcpAck: %u, tcpLen: %hu, tcpFlags: 0x%02x}", \ 405*fdd8201dSApple OSS Distributions SPI, ESP_SEQ, \ 406*fdd8201dSApple OSS Distributions LOCAL_PORT, REMOTE_PORT, TCP_SEQ, TCP_ACK, (uint16_t)TCP_LEN, TCP_FLAGS) 407*fdd8201dSApple OSS Distributions 408*fdd8201dSApple OSS Distributions /*! 409*fdd8201dSApple OSS Distributions * @macro MPKL_ESP_INPUT_TCP 410*fdd8201dSApple OSS Distributions * @discussion Associate an ESP packet for TCP to the TCP segment 411*fdd8201dSApple OSS Distributions * 412*fdd8201dSApple OSS Distributions * @param LOGOBJECT os_log_t object to write data into 413*fdd8201dSApple OSS Distributions * @param SPI uint32_t SPI field in the ESP header 414*fdd8201dSApple OSS Distributions * @param ESP_SEQ uint32_t Sequence number field in the ESP header 415*fdd8201dSApple OSS Distributions * @param LOCAL_PORT uint16_t Local port of the TCP connection 416*fdd8201dSApple OSS Distributions * @param REMOTE_PORT uint16_t Remote port of the TCP connection 417*fdd8201dSApple OSS Distributions * @param TCP_SEQ uint32_t Sequence number in the TCP header of the segment 418*fdd8201dSApple OSS Distributions * @param TCP_LEN uint16_t Length in the TCP header of the segment 419*fdd8201dSApple OSS Distributions */ 420*fdd8201dSApple OSS Distributions #define MPKL_ESP_INPUT_TCP(LOGOBJECT, SPI, ESP_SEQ, LOCAL_PORT, REMOTE_PORT, TCP_SEQ, TCP_LEN) \ 421*fdd8201dSApple OSS Distributions os_log_with_type(LOGOBJECT, (os_log_type_t)net_mpklog_type, \ 422*fdd8201dSApple OSS Distributions "19 {curProtocol: 80 spi: 0x%X, espSeq: %u, PayloadProtocol: 100, " \ 423*fdd8201dSApple OSS Distributions "localPort: %hu, remotePort: %hu, tcpSeq: %u, tcpLen: %hu}", \ 424*fdd8201dSApple OSS Distributions SPI, ESP_SEQ, \ 425*fdd8201dSApple OSS Distributions LOCAL_PORT, REMOTE_PORT, TCP_SEQ, (uint16_t)TCP_LEN) 426*fdd8201dSApple OSS Distributions #endif /* KERNEL */ 427*fdd8201dSApple OSS Distributions 428*fdd8201dSApple OSS Distributions /*! 429*fdd8201dSApple OSS Distributions * @macro MPKL_BYTERANGE_UUID_ASSOCIATE 430*fdd8201dSApple OSS Distributions * @discussion Associate current layer's byte range (start/end) to current layer's UUID 431*fdd8201dSApple OSS Distributions * 432*fdd8201dSApple OSS Distributions * @param LOGOBJECT os_log_t object to write data into 433*fdd8201dSApple OSS Distributions * @param CUR_PROTOCOL_ID uint8_t ID of current layer from MPKL_PROTOCOL_XXX defines above 434*fdd8201dSApple OSS Distributions * @param NEXT_PROTOCOL_ID uint8_t ID of other layer being associated 435*fdd8201dSApple OSS Distributions * @param CUR_UUID uuid_t Current layer 16-byte UUID of endpoint handler 436*fdd8201dSApple OSS Distributions * @param CUR_RANGE_START uint64_t Current layer byte range start 437*fdd8201dSApple OSS Distributions * @param CUR_RANGE_END uint64_t Current layer byte range end 438*fdd8201dSApple OSS Distributions * @param LOG_SEQN uint8_t Incrementing sequence number to detect logging system drop of messages 439*fdd8201dSApple OSS Distributions */ 440*fdd8201dSApple OSS Distributions #define MPKL_BYTERANGE_UUID_ASSOCIATE(LOGOBJECT, CUR_PROTOCOL_ID, NEXT_PROTOCOL_ID, CUR_UUID, CUR_RANGE_START, CUR_RANGE_END, LOG_SEQN) \ 441*fdd8201dSApple OSS Distributions os_log(LOGOBJECT, "32 {curProtocol: %hhu, nextProtocol: %hhu, curUUID: %{public}.16P, curStart: %llu, curEnd: %llu, logSeqn: %hhu}", CUR_PROTOCOL_ID, NEXT_PROTOCOL_ID, CUR_UUID, CUR_RANGE_START, CUR_RANGE_END, LOG_SEQN) 442*fdd8201dSApple OSS Distributions 443*fdd8201dSApple OSS Distributions /*! 444*fdd8201dSApple OSS Distributions * @macro MPKL_UUID_ONLY_ASSOCIATE_NEXT 445*fdd8201dSApple OSS Distributions * @discussion Associate current layer's UUID to next layer's UUID 446*fdd8201dSApple OSS Distributions * 447*fdd8201dSApple OSS Distributions * @param LOGOBJECT os_log_t object to write data into 448*fdd8201dSApple OSS Distributions * @param LABEL string optional layer-specific label for readability/debugability, this is ignored by the parser. Can not contain {} 449*fdd8201dSApple OSS Distributions * @param CUR_PROTOCOL_ID uint8_t ID of current layer from MPKL_PROTOCOL_XXX defines above 450*fdd8201dSApple OSS Distributions * @param NEXT_PROTOCOL_ID uint8_t ID of next layer being associated 451*fdd8201dSApple OSS Distributions * @param CUR_UUID uuid_t Current layer 16-byte UUID 452*fdd8201dSApple OSS Distributions * @param NEXT_UUID uuid_t Next layer 16-byte UUID 453*fdd8201dSApple OSS Distributions * @param LOG_SEQ uint8_t Incrementing sequence number to detect logging system drop of messages 454*fdd8201dSApple OSS Distributions */ 455*fdd8201dSApple OSS Distributions #define MPKL_UUID_ONLY_ASSOCIATE_NEXT(LOGOBJECT, CUR_PROTOCOL_ID, NEXT_PROTOCOL_ID, CUR_UUID, NEXT_UUID, LOG_SEQN) \ 456*fdd8201dSApple OSS Distributions os_log(LOGOBJECT, "33 {curProtocol: %hhu, nextProtocol: %hhu, curUUID: %{public}.16P, nextUUID: %{public}.16P, logSeqn: %hhu}", CUR_PROTOCOL_ID, NEXT_PROTOCOL_ID, CUR_UUID, NEXT_UUID, LOG_SEQN) 457*fdd8201dSApple OSS Distributions 458*fdd8201dSApple OSS Distributions #ifdef KERNEL_PRIVATE 459*fdd8201dSApple OSS Distributions extern int net_mpklog_enabled; 460*fdd8201dSApple OSS Distributions extern uint8_t net_mpklog_type; 461*fdd8201dSApple OSS Distributions #endif /* KERNEL_PRIVATE */ 462*fdd8201dSApple OSS Distributions 463*fdd8201dSApple OSS Distributions #endif /* _NET_MULTI_LAYER_PKT_LOG_H_ */ 464