Intel® Business Client Software Development
Support for Intel® vPro™ software development and technologies associated with Intel vPro platforms.
Announcements
Important Update: Community Platform Migration​. Learn more​>

Redirection Library SocketsCallbacks

inbrian
Beginner
2,061 Views
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
2,061 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.
0 Kudos
inbrian
Beginner
2,061 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.
0 Kudos
Lance_A_Intel
Employee
2,061 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.
0 Kudos
Reply