.\" Man page generated from reStructuredText. . .TH "TSMBUFFERCREATE" "3ts" "Mar 08, 2019" "7.1" "Apache Traffic Server" .SH NAME TSMBufferCreate \- traffic Server marshall buffer API . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .sp \fI#include \fP .INDENT 0.0 .TP .B TSMBuffer TSMBufferCreate(void) .UNINDENT .INDENT 0.0 .TP .B TSReturnCode TSMBufferDestroy(TSMBuffer\fI\ bufp\fP) .UNINDENT .INDENT 0.0 .TP .B TSReturnCode TSHandleMLocRelease(TSMBuffer\fI\ bufp\fP, TSMLoc\fI\ parent\fP, TSMLoc\fI\ mloc\fP) .UNINDENT .SH DESCRIPTION .sp The marshal buffer or \fBTSMBuffer\fP is a heap data structure that stores parsed URLs, MIME headers and HTTP headers. You can allocate new objects out of marshal buffers, and change the values within the marshal buffer. Whenever you manipulate an object, you require the handle to the object (\fBTSMLoc\fP) and the marshal buffer containing the object (\fBTSMBuffer\fP). .sp Any marshal buffer fetched by transaction getters will be used by other parts of the system. Be careful not to destroy these shared, transaction marshal buffers. .sp \fI\%TSMBufferCreate()\fP creates a new marshal buffer and initializes the reference count. \fI\%TSMBufferDestroy()\fP Ignores the reference count and destroys the marshal buffer bufp. The internal data buffer associated with the marshal buffer is also destroyed if the marshal buffer allocated it. .sp \fI\%TSHandleMLocRelease()\fP Releases the \fBTSMLoc\fP mloc created from the \fBTSMLoc\fP parent. If a \fBTSMLoc\fP is obtained from a transaction, it does not have a parent \fBTSMLoc\fP\&. Use the the constant \fBTS_NULL_MLOC\fP as its parent. .SH RETURN VALUES .sp \fI\%TSMBufferDestroy()\fP and \fI\%TSHandleMLocRelease()\fP return \fBTS_SUCCESS\fP on success, or \fBTS_ERROR\fP on failure. \fI\%TSMBufferCreate()\fP returns the new \fBTSMBuffer\fP\&. .SH EXAMPLES .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C #include static void copyResponseMimeHdr (TSCont pCont, TSHttpTxn pTxn) { TSMBuffer respHdrBuf, tmpBuf; TSMLoc respHttpHdrLoc, tmpMimeHdrLoc; if (!TSHttpTxnClientRespGet(pTxn, &respHdrBuf, &respHttpHdrLoc)) { TSError("couldn\(aqt retrieve client response header0); TSHandleMLocRelease(respHdrBuf, TS_NULL_MLOC, respHttpHdrLoc); goto done; } tmpBuf = TSMBufferCreate(); tmpMimeHdrLoc = TSMimeHdrCreate(tmpBuf); TSMimeHdrCopy(tmpBuf, tmpMimeHdrLoc, respHdrBuf, respHttpHdrLoc); TSHandleMLocRelease(tmpBuf, TS_NULL_MLOC, tmpMimeHdrLoc); TSHandleMLocRelease(respHdrBuf, TS_NULL_MLOC, respHttpHdrLoc); TSMBufferDestroy(tmpBuf); done: TSHttpTxnReenable(pTxn, TS_EVENT_HTTP_CONTINUE); } .ft P .fi .UNINDENT .UNINDENT .SH SEE ALSO .sp \fBTSAPI(3ts)\fP .SH COPYRIGHT 2019, dev@trafficserver.apache.org .\" Generated by docutils manpage writer. .