Datasheet
API in C using winsock
59
}
// determine endianness of this machine
// iLittleEndian will be set to 1 if we are
// on a little endian machine...otherwise
// we are assumed to be on a big endian processor
iLittleEndian = isLittleEndian();
return fdSock;
}
/********************************************************************
* Disconnect from API
* Close the API socket
********************************************************************/
void apiDisconnect(int fdSock)
{
DEBUG ? printf("Closing socket\n") : 0;
closesocket(fdSock);
}
/********************************************************************
* Login to the API
* 1 is returned on successful login
* 0 is returned on unsuccessful login
********************************************************************/
int login(int fdSock, char *username, char *password)
{
struct Sentence stReadSentence;
struct Sentence stWriteSentence;
char *szMD5Challenge;
char *szMD5ChallengeBinary;
char *szMD5PasswordToSend;
char *szLoginUsernameResponseToSend;
char *szLoginPasswordResponseToSend;
md5_state_t state;
md5_byte_t digest[16];
char cNull[1] = {0};
writeWord(fdSock, "/login");
writeWord(fdSock, "");










