Community
cancel
Showing results for 
Search instead for 
Did you mean: 
inbrian
Beginner
53 Views

Redirection Library SocketsCallbacks

The redirection library allows the developer to provide custom callbacks for communications. To do this, the library is initialized using:

IMRResult IMR_InitEx(
IMRVersion *version,
char *ini_file
SocketsCallbacks* socketsCallbacks
);

SocketsCallbacks is defined as :

typedef struct _SocketsCallbacks{
Open open_connection;
Close close_connection;
Receive receive_data;
Send send_data;
} SocketsCallbacks;

Receive is:
typedef int (*Receive)(unsigned char* buffer, unsigned int* length, unsigned int conID);

I cannot find documentation for the parameters of the this function. What I'm thinking:
1. char* buffer is a pointer to pre-allocated memory where the results of the receive will be stored
2 connId is the connection that the receive is wanting to receive data on

However, I need to know:
1. How can I tell the size of the receive buffer? It appears that length is probably an out parameter, since it is a pointer. Or maybe is it telling the size of the buffer?
2. What should the function return? Is it the number of bytes received or perhaps IMR_RES_OK (in the case of no error)

Any help would be appreciated. I apologize if I missed this somewhere in the docs.

0 Kudos
3 Replies
Lance_A_Intel
Employee
53 Views


Hello,
Section 3.4.3.5 of the Redirection Library Design Guide (in the DOCS folder of the SDK)provides the description of this funciton.
inbrian
Beginner
53 Views


Hello,
Section 3.4.3.5 of the Redirection Library Design Guide (in the DOCS folder of the SDK)provides the description of this funciton.

Well, I apologize. It was right there only a couple pages up. Thanks for the help : ) Apparently length is both an in parameter and an out parameter. Interesting.
Lance_A_Intel
Employee
53 Views

Quoting - inbrian

Well, I apologize. It was right there only a couple pages up. Thanks for the help : ) Apparently length is both an in parameter and an out parameter. Interesting.

No need to apologize and you are welcome.

Yes, the input/output is used to allow the caller to indicate (input)how much buffer space is availableand get back (output)how much of it was used.
Reply