Files
asterisk/main/minimime/mm-docs/html/group__envelope.html
Russell Bryant 06ff84b549 To be able to achieve the things that we would like to achieve with the
Asterisk GUI project, we need a fully functional HTTP interface with access
to the Asterisk manager interface.  One of the things that was intended to be
a part of this system, but was never actually implemented, was the ability for
the GUI to be able to upload files to Asterisk.  So, this commit adds this in
the most minimally invasive way that we could come up with.

A lot of work on minimime was done by Steve Murphy.  He fixed a lot of bugs in
the parser, and updated it to be thread-safe.  The ability to check
permissions of active manager sessions was added by Dwayne Hubbard.  Then,
hacking this all together and do doing the modifications necessary to the HTTP
interface was done by me.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@60603 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-04-06 20:58:43 +00:00

173 lines
8.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>MiniMIME: Accessing and manipulating a message&apos;s envelope</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<h1>Accessing and manipulating a message's envelope</h1><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Accessing and manipulating a message's envelope</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__envelope.html#g38f1164142cedfc3253b068a81f85563">mm_envelope_getheaders</a> (MM_CTX *ctx, char **result, size_t *length)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__envelope.html#gb2c43c1645e42ae0860c902ce1dda788">mm_envelope_setheader</a> (MM_CTX *ctx, const char *name, const char *fmt,...)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__envelope.html#ge63da17c56867ca2406a4eaf73230baf">mm_envelope_getrecipients</a> (MM_CTX *ctx, char **result, size_t *length)</td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="g38f1164142cedfc3253b068a81f85563"></a><!-- doxytag: member="mm_envelope.c::mm_envelope_getheaders" ref="g38f1164142cedfc3253b068a81f85563" args="(MM_CTX *ctx, char **result, size_t *length)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_envelope_getheaders </td>
<td>(</td>
<td class="paramtype">MM_CTX *&nbsp;</td>
<td class="paramname"> <em>ctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char **&nbsp;</td>
<td class="paramname"> <em>result</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t *&nbsp;</td>
<td class="paramname"> <em>length</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Gets an ASCII representation of all envelope headers<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>A valid MiniMIME context </td></tr>
<tr><td valign="top"></td><td valign="top"><em>result</em>&nbsp;</td><td>Where to store the resulting ASCII headers </td></tr>
<tr><td valign="top"></td><td valign="top"><em>length</em>&nbsp;</td><td>Where to store the length of the result </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on failure. </dd></dl>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Sets mm_errno on failure</dd></dl>
This is mainly a convinience function. It constructs an ASCII representation from all of the message's envelope headers and stores the result in headers. Memory is allocated dynamically, and the total length of the result is stored in length. This function takes care that the output is MIME conform, and folds long lines according to the MIME standard at position 78 of the string. It also nicely formats all MIME related header fields, such as the Content-Type header.<p>
Since the memory needed to store the result is allocated dynamically, one should take care of freeing it again when it's not needed anymore. If an error occurs, *result will be set to NULL, *length will be set to zero and mm_errno will be set to a reasonable value.
</div>
</div><p>
<a class="anchor" name="ge63da17c56867ca2406a4eaf73230baf"></a><!-- doxytag: member="mm_envelope.c::mm_envelope_getrecipients" ref="ge63da17c56867ca2406a4eaf73230baf" args="(MM_CTX *ctx, char **result, size_t *length)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_envelope_getrecipients </td>
<td>(</td>
<td class="paramtype">MM_CTX *&nbsp;</td>
<td class="paramname"> <em>ctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char **&nbsp;</td>
<td class="paramname"> <em>result</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t *&nbsp;</td>
<td class="paramname"> <em>length</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Gets the list of recipients for a MIME message<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>A valid MiniMIME context </td></tr>
<tr><td valign="top"></td><td valign="top"><em>result</em>&nbsp;</td><td>Where to store the result </td></tr>
<tr><td valign="top"></td><td valign="top"><em>length</em>&nbsp;</td><td>Where to store the length of the result </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on error </dd></dl>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Sets mm_errno on error</dd></dl>
This functions gets the list of recipients for a given MIME message. It does so by concatenating the "From" and "Cc" header fields, and storing the results in recipients. The memory needed to store the result is allocated dynamically, and the total length of the result is stored in length.<p>
One should take care to free() the result once it's not needed anymore.
</div>
</div><p>
<a class="anchor" name="gb2c43c1645e42ae0860c902ce1dda788"></a><!-- doxytag: member="mm_envelope.c::mm_envelope_setheader" ref="gb2c43c1645e42ae0860c902ce1dda788" args="(MM_CTX *ctx, const char *name, const char *fmt,...)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mm_envelope_setheader </td>
<td>(</td>
<td class="paramtype">MM_CTX *&nbsp;</td>
<td class="paramname"> <em>ctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&nbsp;</td>
<td class="paramname"> <em>fmt</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&nbsp;</td>
<td class="paramname"> <em>...</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets a header field in the envelope<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ctx</em>&nbsp;</td><td>A valid MiniMIME context </td></tr>
<tr><td valign="top"></td><td valign="top"><em>name</em>&nbsp;</td><td>The name of the header field to set </td></tr>
<tr><td valign="top"></td><td valign="top"><em>fmt</em>&nbsp;</td><td>A format string specifying the value of the header field </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on success or -1 on failure</dd></dl>
This function generates a new MIME header and attaches it to the first MIME part (the envelope) found in the given context. If no part is attached already, the function will return an error. The function will store a copy of ``name'' as the header's name field, and dynamically allocate the memory needed to build the format string.
</div>
</div><p>
<hr size="1"><address style="align: right;"><small>Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>