SICS-764: Provide access to the asynnet socket descriptor's write buffer.

We need this to implement a "capture" command that doesn't cause SICS to
commit suicide if you capture a "run" command.
NOTE: This is a bit dodgy because we're trusting callers not to modify the write buffer.
This commit is contained in:
Ferdi Franceschini
2014-08-05 12:20:11 +10:00
parent 8a6da09326
commit fc7771f359
2 changed files with 16 additions and 0 deletions

View File

@ -632,3 +632,14 @@ int ANETreadTillTerm(int handle,
} }
return ANETTIMEOUT; return ANETTIMEOUT;
} }
char *ANETgetWBuffer(int handle) {
pSocketDescriptor sock;
int len;
char *wdata;
sock = findSocketDescriptor(handle);
wdata = (char *) GetRWBufferData(sock->writeBuffer, &len);
wdata[len] = '\0';
return wdata;
}

View File

@ -207,4 +207,9 @@ int ANETreadTillTerm(int handle,
* \param userData An opaque pointer with data for lcb * \param userData An opaque pointer with data for lcb
*/ */
void ANETsetLog(ANETlog lcb, void *userData); void ANETsetLog(ANETlog lcb, void *userData);
/**
* \brief Return a pointer to the socket descriptor write buffer
* \param handle Connection object socket handle
*/
char *ANETgetWBuffer(int handle);
#endif /*ASYNNET_H_ */ #endif /*ASYNNET_H_ */