Update control connection for GFE 2.0.1+. Remove config and handshake code that isn't used on GFE 2.0.1+

This commit is contained in:
Cameron Gutman
2014-06-28 21:19:39 -07:00
parent 929487249d
commit ee96cccb51
10 changed files with 147 additions and 358 deletions
+35
View File
@@ -8,6 +8,15 @@ void BbInitializeWrappedBuffer(PBYTE_BUFFER buff, char* data, int offset, int le
buff->byteOrder = byteOrder;
}
static long long byteSwapLongLong(PBYTE_BUFFER buff, long long l) {
if (buff->byteOrder == BYTE_ORDER_BIG) {
return HTONLL(l);
}
else {
return l;
}
}
static int byteSwapInt(PBYTE_BUFFER buff, int i) {
if (buff->byteOrder == BYTE_ORDER_BIG) {
return htonl(i);
@@ -63,6 +72,19 @@ int BbGetInt(PBYTE_BUFFER buff, int *i) {
return 1;
}
int BbGetLong(PBYTE_BUFFER buff, long long *l) {
if (buff->position + sizeof(*l) > buff->length) {
return 0;
}
memcpy(l, &buff->buffer[buff->position], sizeof(*l));
buff->position += sizeof(*l);
*l = byteSwapInt(buff, *l);
return 1;
}
int BbPutInt(PBYTE_BUFFER buff, int i) {
if (buff->position + sizeof(i) > buff->length) {
return 0;
@@ -76,6 +98,19 @@ int BbPutInt(PBYTE_BUFFER buff, int i) {
return 1;
}
int BbPutLong(PBYTE_BUFFER buff, long long l) {
if (buff->position + sizeof(l) > buff->length) {
return 0;
}
l = byteSwapInt(buff, l);
memcpy(&buff->buffer[buff->position], &l, sizeof(l));
buff->position += sizeof(l);
return 1;
}
int BbPutShort(PBYTE_BUFFER buff, short s) {
if (buff->position + sizeof(s) > buff->length) {
return 0;