|
|
@ -783,119 +783,3 @@ void NetVaultNode::SetBlob_1 (const uint8_t v[], uint32_t len) { |
|
|
|
void NetVaultNode::SetBlob_2 (const uint8_t v[], uint32_t len) { |
|
|
|
void NetVaultNode::SetBlob_2 (const uint8_t v[], uint32_t len) { |
|
|
|
IVaultNodeSetBlob(kBlob_2, &blob_2, &blob_2Length, v, len); |
|
|
|
IVaultNodeSetBlob(kBlob_2, &blob_2, &blob_2Length, v, len); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* CSrvPackBuffer |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
***/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
CSrvPackBuffer::CSrvPackBuffer (unsigned bytes) { |
|
|
|
|
|
|
|
m_data = (uint8_t *)malloc(bytes); |
|
|
|
|
|
|
|
m_pos = m_data; |
|
|
|
|
|
|
|
m_end = m_pos + bytes; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void * CSrvPackBuffer::Alloc (unsigned bytes) { |
|
|
|
|
|
|
|
ASSERT((signed) bytes >= 0); |
|
|
|
|
|
|
|
ASSERT(m_pos + bytes <= m_end); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t * pos = m_pos; |
|
|
|
|
|
|
|
m_pos += bytes; |
|
|
|
|
|
|
|
return pos; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void CSrvPackBuffer::AddData (const void * ptr, unsigned bytes) { |
|
|
|
|
|
|
|
memcpy(Alloc(bytes), ptr, bytes); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void CSrvPackBuffer::AddString (const wchar_t str[]) { |
|
|
|
|
|
|
|
AddData(str, StrBytes(str)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
void CSrvPackBuffer::AddDWordArray (const uint32_t * arr, unsigned count) { |
|
|
|
|
|
|
|
// Don't let large counts cause pointer wrap
|
|
|
|
|
|
|
|
count &= 0x00ffffff; |
|
|
|
|
|
|
|
AddData(arr, count * sizeof(arr[0])); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
unsigned CSrvPackBuffer::Size () { |
|
|
|
|
|
|
|
return m_pos - m_data; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* CSrvUnpackBuffer |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
***/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
CSrvUnpackBuffer::CSrvUnpackBuffer (const void * buffer, unsigned count) { |
|
|
|
|
|
|
|
m_pos = (const uint8_t *) buffer; |
|
|
|
|
|
|
|
m_end = m_pos + count; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
const void * CSrvUnpackBuffer::GetData (unsigned bytes) { |
|
|
|
|
|
|
|
for (;;) { |
|
|
|
|
|
|
|
const uint8_t * result = m_pos; |
|
|
|
|
|
|
|
m_pos += bytes; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (m_pos < result) |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
if (m_pos > m_end) |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_end = nil; |
|
|
|
|
|
|
|
return nil; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
const wchar_t * CSrvUnpackBuffer::GetString () { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (m_end) {
|
|
|
|
|
|
|
|
const wchar_t * end = (const wchar_t *) (m_end - sizeof(wchar_t) + 1);
|
|
|
|
|
|
|
|
for (const wchar_t * cur = (const wchar_t *) m_pos; cur < end; ) {
|
|
|
|
|
|
|
|
if (*cur++)
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const wchar_t * pos = (const wchar_t *) m_pos;
|
|
|
|
|
|
|
|
m_pos = (const uint8_t *) cur;
|
|
|
|
|
|
|
|
return pos;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_end = NULL;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
const uint32_t * CSrvUnpackBuffer::GetDWordArray (unsigned count) { |
|
|
|
|
|
|
|
// Don't let large counts cause pointer wrap
|
|
|
|
|
|
|
|
if (count & 0x00ffffff) |
|
|
|
|
|
|
|
return (const uint32_t *)GetData(count * sizeof(uint32_t)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_end = nil; |
|
|
|
|
|
|
|
return nil; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
unsigned CSrvUnpackBuffer::BytesLeft () { |
|
|
|
|
|
|
|
return m_end ? m_end - m_pos : 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
bool CSrvUnpackBuffer::ParseError () { |
|
|
|
|
|
|
|
return !m_end; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|