Authenticates to the Message Feed server. Each client submitting messages to the Message Feed server must authenticate itself with a name and a password.
int mfp_Authenticate(h_mfp hMFP, int RequestId, char const* pUser, char const* pPassword);
hMFP
– The handle to the Message Feed connection.RequestId
– Identifies this request. It is returned in the reply received by the mfp_GetReply
function in order to correlate a reply with its request.pUser
– User name for the Message Feed client.pPassword
– Password for the specified user. The function returns 0 if the request was successfully sent to the Message Feed server, or -1 in case of error. Use the mfp_GetLastError function to get a textual description of the error.
... if(mfp_Authenticate(hMFP, 0, "user", "passwd") < 0) {
printf("failed to authenticate to Message Feed server: %s\n", mfp_GetLastError()); exit(1); } pReply = mfp_GetReply(hMFP, 60); if(pReply == NULL) { printf("failed to get authentication reply: %s\n", mfp_GetLastError()); exit(1); } if(pReply->Status != MFP_REPLYSTATUS_OK) { printf("failed to authenticate: %s\n", mfp_StatusToString(pReply->Status)); exit(1); } mfp_FreeReply(pReply); ... |