|
|
@@ -93,9 +93,27 @@ struct JackRequest |
|
|
kPropertyChangeNotify = 40, |
|
|
kPropertyChangeNotify = 40, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static const int StartMarker = 'R' | ('e' << 8) | ('q' << 16) | ('S' << 24); |
|
|
|
|
|
|
|
|
static int ReadType(detail::JackChannelTransactionInterface* trans, RequestType& type) |
|
|
static int ReadType(detail::JackChannelTransactionInterface* trans, RequestType& type) |
|
|
{ |
|
|
{ |
|
|
type = (RequestType)0; |
|
|
type = (RequestType)0; |
|
|
|
|
|
|
|
|
|
|
|
do { |
|
|
|
|
|
PRE_PACKED_STRUCTURE |
|
|
|
|
|
union { |
|
|
|
|
|
int i; |
|
|
|
|
|
uint8_t b[sizeof(i)]; |
|
|
|
|
|
} POST_PACKED_STRUCTURE start; |
|
|
|
|
|
|
|
|
|
|
|
CheckRes(trans->Read(&start.i, sizeof(StartMarker))); |
|
|
|
|
|
if (start.i != StartMarker) { |
|
|
|
|
|
jack_error("Request start marker not found. Ignoring %02x %02x %02x %02x ", |
|
|
|
|
|
start.b[0], start.b[1], start.b[2], start.b[3]); |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
} while (false); |
|
|
|
|
|
|
|
|
CheckRes(trans->Read(&type, sizeof(RequestType))); |
|
|
CheckRes(trans->Read(&type, sizeof(RequestType))); |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
@@ -112,6 +130,7 @@ template<class DATA> |
|
|
struct JackRequestMessage |
|
|
struct JackRequestMessage |
|
|
{ |
|
|
{ |
|
|
protected: |
|
|
protected: |
|
|
|
|
|
const int fStart = JackRequest::StartMarker; |
|
|
const JackRequest::RequestType fType; |
|
|
const JackRequest::RequestType fType; |
|
|
const int fSize; |
|
|
const int fSize; |
|
|
public: |
|
|
public: |
|
|
@@ -120,7 +139,7 @@ public: |
|
|
protected: |
|
|
protected: |
|
|
template<typename... Args> |
|
|
template<typename... Args> |
|
|
JackRequestMessage(Args&... args) : fType(DATA::Type()), |
|
|
JackRequestMessage(Args&... args) : fType(DATA::Type()), |
|
|
fSize(sizeof(JackRequestMessage<DATA>) - sizeof(fType) - sizeof(fSize)), |
|
|
|
|
|
|
|
|
fSize(sizeof(JackRequestMessage<DATA>) - sizeof(fStart) - sizeof(fType) - sizeof(fSize)), |
|
|
d(args...) |
|
|
d(args...) |
|
|
{} |
|
|
{} |
|
|
|
|
|
|
|
|
|