mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 01:49:05 +00:00
add libetpan 0.48 to in tree libs
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3763 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1841
libs/libetpan/doc/API/book1.htm
Normal file
1841
libs/libetpan/doc/API/book1.htm
Normal file
File diff suppressed because it is too large
Load Diff
139
libs/libetpan/doc/API/c13.htm
Normal file
139
libs/libetpan/doc/API/c13.htm
Normal file
@@ -0,0 +1,139 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Introduction</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="libEtPan! API"
|
||||
HREF="book1.htm"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="libEtPan! API"
|
||||
HREF="book1.htm"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Tools and datatypes"
|
||||
HREF="c16.htm"></HEAD
|
||||
><BODY
|
||||
CLASS="CHAPTER"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>libEtPan! API</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="book1.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="c16.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="CHAPTER"
|
||||
><H1
|
||||
><A
|
||||
NAME="AEN13"
|
||||
></A
|
||||
>Chapter 1. Introduction</H1
|
||||
><P
|
||||
> This document will describe the API of libEtPan!
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.htm"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="c16.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>libEtPan! API</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Tools and datatypes</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
303
libs/libetpan/doc/API/c1586.htm
Normal file
303
libs/libetpan/doc/API/c1586.htm
Normal file
@@ -0,0 +1,303 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>MIME</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="libEtPan! API"
|
||||
HREF="book1.htm"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Rendering of messages"
|
||||
HREF="x1556.htm"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Data types"
|
||||
HREF="x1614.htm"></HEAD
|
||||
><BODY
|
||||
CLASS="CHAPTER"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>libEtPan! API</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x1556.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x1614.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="CHAPTER"
|
||||
><H1
|
||||
><A
|
||||
NAME="AEN1586"
|
||||
></A
|
||||
>Chapter 4. MIME</H1
|
||||
><DIV
|
||||
CLASS="TOC"
|
||||
><DL
|
||||
><DT
|
||||
><B
|
||||
>Table of Contents</B
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="c1586.htm#AEN1598"
|
||||
>Quick start</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x1614.htm"
|
||||
>Data types</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x2180.htm"
|
||||
>Parser functions</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x2583.htm"
|
||||
>Rendering of MIME parts</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x2669.htm"
|
||||
>Creation functions</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x2946.htm"
|
||||
>Helper functions</A
|
||||
></DT
|
||||
></DL
|
||||
></DIV
|
||||
><P
|
||||
> libEtPan! implements a MIME message parser (also known as
|
||||
messages with attachments or
|
||||
multipart messages). This also allows to generate MIME messages.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="WARNING"
|
||||
><P
|
||||
></P
|
||||
><TABLE
|
||||
CLASS="WARNING"
|
||||
BORDER="1"
|
||||
WIDTH="100%"
|
||||
><TR
|
||||
><TD
|
||||
ALIGN="CENTER"
|
||||
><B
|
||||
>Warning</B
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
ALIGN="LEFT"
|
||||
><P
|
||||
> All allocation functions will take as argument allocated data
|
||||
and will store these data in the structure they will allocate.
|
||||
Data should be persistant during all the use of the structure
|
||||
and will be freed by the free function of the structure
|
||||
</P
|
||||
><P
|
||||
> allocation functions will return <B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> on failure
|
||||
|
||||
functions returning integer will be returning one of the
|
||||
following error code:
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>MAILIMF_NO_ERROR</B
|
||||
>,
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>MAILIMF_ERROR_PARSE</B
|
||||
>,
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>MAILIMF_ERROR_MEMORY</B
|
||||
>,
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>MAILIMF_ERROR_INVAL</B
|
||||
>,
|
||||
or <B
|
||||
CLASS="COMMAND"
|
||||
>MAILIMF_ERROR_FILE</B
|
||||
>.
|
||||
</P
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="AEN1598"
|
||||
>Quick start</A
|
||||
></H1
|
||||
><P
|
||||
> You will need this module when you want to parse a MIME
|
||||
message.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="AEN1601"
|
||||
>Parse MIME message</A
|
||||
></H2
|
||||
><P
|
||||
> You will use the following function :
|
||||
</P
|
||||
><P
|
||||
></P
|
||||
><UL
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailmime_parse</B
|
||||
>
|
||||
(<A
|
||||
HREF="x1094.htm#MAILIMF-ENVELOPE-AND-OPTIONAL-FIELDS-PARSE"
|
||||
>the Section called <I
|
||||
>mailimf_envelope_and_optional_fields_parse</I
|
||||
> in Chapter 3</A
|
||||
>)
|
||||
</P
|
||||
></LI
|
||||
></UL
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="AEN1609"
|
||||
>Render the MIME message</A
|
||||
></H2
|
||||
><P
|
||||
> Build your MIME message, then use
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>mailmime_write</B
|
||||
>
|
||||
(<A
|
||||
HREF="x2583.htm#MAILMIME-WRITE"
|
||||
>the Section called <I
|
||||
>mailmime_write</I
|
||||
></A
|
||||
>)
|
||||
to render a MIME message.
|
||||
</P
|
||||
></DIV
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x1556.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.htm"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x1614.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Rendering of messages</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Data types</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
629
libs/libetpan/doc/API/c16.htm
Normal file
629
libs/libetpan/doc/API/c16.htm
Normal file
@@ -0,0 +1,629 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Tools and datatypes</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="libEtPan! API"
|
||||
HREF="book1.htm"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Introduction"
|
||||
HREF="c13.htm"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="List"
|
||||
HREF="x88.htm"></HEAD
|
||||
><BODY
|
||||
CLASS="CHAPTER"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>libEtPan! API</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="c13.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x88.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="CHAPTER"
|
||||
><H1
|
||||
><A
|
||||
NAME="AEN16"
|
||||
></A
|
||||
>Chapter 2. Tools and datatypes</H1
|
||||
><DIV
|
||||
CLASS="TOC"
|
||||
><DL
|
||||
><DT
|
||||
><B
|
||||
>Table of Contents</B
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="c16.htm#AEN19"
|
||||
>Array</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x88.htm"
|
||||
>List</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x161.htm"
|
||||
>Hash table</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x229.htm"
|
||||
>Buffered I/O</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x289.htm"
|
||||
>non-buffered I/O</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x312.htm"
|
||||
>strings</A
|
||||
></DT
|
||||
></DL
|
||||
></DIV
|
||||
><P
|
||||
> libEtPan! include a collection of datatypes such as lists,
|
||||
arrays, hash tables and tools such as buffered I/O.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="AEN19"
|
||||
>Array</A
|
||||
></H1
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
typedef struct carray_s carray;
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>carray</B
|
||||
> is an array of pointers that will
|
||||
resize automatically in case a new element is added.
|
||||
</P
|
||||
><P
|
||||
>
|
||||
The <B
|
||||
CLASS="COMMAND"
|
||||
>carray</B
|
||||
> is implemented with an array
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>(void **)</B
|
||||
> that can be resized. An array has a
|
||||
size: this is the number of elements that can be added before
|
||||
the table is resized. It also has a count of elements: this is
|
||||
the elements that exist in the array.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="CARRAY-NEW"
|
||||
>carray_new and carray_free</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>carray * carray_new(unsigned int initsize);
|
||||
|
||||
void carray_free(carray * array);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>carray_new()</B
|
||||
> creates a new array with an
|
||||
initial size. The array is not resized until the number of
|
||||
element reach the initial size. It returns
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> in case of failure.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>carray_free()</B
|
||||
> releases memory used by the
|
||||
given array.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="EXAMPLE"
|
||||
><A
|
||||
NAME="AEN35"
|
||||
></A
|
||||
><P
|
||||
><B
|
||||
>Example 2-1. carray creation</B
|
||||
></P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define SIZE 50
|
||||
|
||||
int main(void)
|
||||
{
|
||||
carray * a;
|
||||
|
||||
a = carray_new(SIZE);
|
||||
if (a == NULL)
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
/* do things here */
|
||||
|
||||
carray_free(a);
|
||||
|
||||
exit(EXIT_SUCESS);
|
||||
}
|
||||
</PRE
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="CARRAY-SET-SIZE"
|
||||
>carray_set_size</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int carray_set_size(carray * array, uint32_t new_size);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>carray_set_size()</B
|
||||
> sets the size of the
|
||||
array. It returns <B
|
||||
CLASS="COMMAND"
|
||||
>0</B
|
||||
> in case of success,
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>-1</B
|
||||
> in case of failure.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="EXAMPLE"
|
||||
><A
|
||||
NAME="AEN45"
|
||||
></A
|
||||
><P
|
||||
><B
|
||||
>Example 2-2. preallocating carray</B
|
||||
></P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define SIZE 50
|
||||
#define NEWSIZE 200
|
||||
|
||||
int main(void)
|
||||
{
|
||||
carray * a;
|
||||
unsigned int i;
|
||||
char p[500];
|
||||
|
||||
a = carray_new(SIZE);
|
||||
if (a == NULL)
|
||||
goto err;
|
||||
|
||||
r = carray_set_size(NEWSIZE);
|
||||
if (r < 0)
|
||||
goto free;
|
||||
|
||||
for(i = 0 ; i < NEWSIZE ; i ++)
|
||||
carray_set(a, i, &p[i]);
|
||||
|
||||
/* do things here */
|
||||
|
||||
carray_free(a);
|
||||
|
||||
exit(EXIT_SUCESS);
|
||||
|
||||
free:
|
||||
carray_free(a);
|
||||
err:
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
</PRE
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="CARRAY-COUNT"
|
||||
>carray_count, carray_add, carray_get and carray_set</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int carray_count(carray);
|
||||
|
||||
int carray_add(carray * array, void * data, unsigned int * index);
|
||||
|
||||
void * carray_get(carray * array, unsigned int indx);
|
||||
|
||||
void carray_set(carray * array, unsigned int indx, void * value);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>carray_count()</B
|
||||
> returns the number of
|
||||
elements in the <B
|
||||
CLASS="COMMAND"
|
||||
>carray</B
|
||||
>.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>carray_add()</B
|
||||
>adds an element at the end of
|
||||
the array. The <B
|
||||
CLASS="COMMAND"
|
||||
>index</B
|
||||
> of the element is
|
||||
returns in <B
|
||||
CLASS="COMMAND"
|
||||
>(* index)</B
|
||||
> if
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>index</B
|
||||
> is not <B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
>. It
|
||||
returns <B
|
||||
CLASS="COMMAND"
|
||||
>0</B
|
||||
> in case of success,
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>-1</B
|
||||
> in case of failure.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>carray_get()</B
|
||||
> returns the elements contained
|
||||
at the given cell of the table.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>carray_set()</B
|
||||
> replace the element at the
|
||||
given index of table table with the given value.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
><DIV
|
||||
CLASS="EXAMPLE"
|
||||
><A
|
||||
NAME="AEN66"
|
||||
></A
|
||||
><P
|
||||
><B
|
||||
>Example 2-3. carray access</B
|
||||
></P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
#include <string.h>
|
||||
|
||||
#define SIZE 50
|
||||
|
||||
int main(void)
|
||||
{
|
||||
carray * a;
|
||||
int r;
|
||||
|
||||
a = carray_new(SIZE);
|
||||
if (a == NULL)
|
||||
goto err;
|
||||
|
||||
r = carray_add(a, "foo-bar-1", NULL);
|
||||
if (r < 0)
|
||||
goto free;
|
||||
|
||||
carray_add(a, "foo-bar-2", NULL);
|
||||
if (r < 0)
|
||||
goto free;
|
||||
|
||||
carray_add(a, "foo-bar-3", NULL);
|
||||
if (r < 0)
|
||||
goto free;
|
||||
|
||||
for(i = 0 ; i < carray_count(a) ; i ++) {
|
||||
char * str;
|
||||
|
||||
str = carray_get(a, i);
|
||||
if (strcmp("foo-bar-2", str) == 0)
|
||||
carray_set(a, i, "foo-bar-2-replacement");
|
||||
|
||||
printf("%s\n", str);
|
||||
}
|
||||
|
||||
carray_free(a);
|
||||
|
||||
exit(EXIT_SUCESS);
|
||||
|
||||
free:
|
||||
carray_free(a);
|
||||
err:
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
</PRE
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="CARRAY-DELETE"
|
||||
>carray_delete</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int carray_delete(carray * array, uint32_t indx);
|
||||
|
||||
int carray_delete_slow(carray * array, uint32_t indx);
|
||||
|
||||
int carray_delete_fast(carray * array, uint32_t indx);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>carray_delete()</B
|
||||
> removes an element of the
|
||||
table. Order will not be garanteed. The returned result can
|
||||
be ignored.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>carray_delete_slow()</B
|
||||
> removes an element of
|
||||
the table. Order will be garanteed. The returned result can
|
||||
be ignored.
|
||||
Complexity is O(n).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>carray_delete_fast()</B
|
||||
> the element will just
|
||||
be replaced with <B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
>. Order will be kept
|
||||
but the number of elements will remains the same. The
|
||||
returned result can be ignored.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
><DIV
|
||||
CLASS="EXAMPLE"
|
||||
><A
|
||||
NAME="AEN79"
|
||||
></A
|
||||
><P
|
||||
><B
|
||||
>Example 2-4. deletion in carray</B
|
||||
></P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
#define SIZE 50
|
||||
|
||||
carray * build_array(void)
|
||||
{
|
||||
carray * a;
|
||||
|
||||
a = carray_new(SIZE);
|
||||
if (a == NULL)
|
||||
goto err;
|
||||
|
||||
r = carray_add(a, "foo-bar-1", NULL);
|
||||
if (r < 0)
|
||||
goto free;
|
||||
|
||||
carray_add(a, "foo-bar-2", NULL);
|
||||
if (r < 0)
|
||||
goto free;
|
||||
|
||||
carray_add(a, "foo-bar-3", NULL);
|
||||
if (r < 0)
|
||||
goto free;
|
||||
|
||||
return a;
|
||||
|
||||
free:
|
||||
carray_free(a);
|
||||
err:
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void delete(carray * a)
|
||||
{
|
||||
/* deleting foo-bar-1 */
|
||||
carray_delete(a, 0);
|
||||
/* resulting size is 2, order of elements is undefined */
|
||||
}
|
||||
|
||||
void delete_slow(carray * a)
|
||||
{
|
||||
/* deleting foo-bar-1 */
|
||||
carray_delete_slow(a, 0);
|
||||
/* resulting size is 2, order of elements is the same */
|
||||
}
|
||||
|
||||
void delete_fast(carray * a)
|
||||
{
|
||||
/* deleting foo-bar-1 */
|
||||
carray_delete_slow(a, 0);
|
||||
/*
|
||||
resulting size is 3,
|
||||
order of elements is { NULL, foo-bar-2, foo-bar-3 }
|
||||
*/
|
||||
}
|
||||
</PRE
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="CARRAY-DATA"
|
||||
>carray_data</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>void ** carray_data(carray);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>carray_data</B
|
||||
>returns the table used for
|
||||
implementation :
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>(void **)</B
|
||||
>.
|
||||
</P
|
||||
></DIV
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="c13.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.htm"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x88.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Introduction</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>List</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
271
libs/libetpan/doc/API/c2988.htm
Normal file
271
libs/libetpan/doc/API/c2988.htm
Normal file
@@ -0,0 +1,271 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Storages, folders, messages</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="libEtPan! API"
|
||||
HREF="book1.htm"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Helper functions"
|
||||
HREF="x2946.htm"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Error codes"
|
||||
HREF="x3011.htm"></HEAD
|
||||
><BODY
|
||||
CLASS="CHAPTER"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>libEtPan! API</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x2946.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x3011.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="CHAPTER"
|
||||
><H1
|
||||
><A
|
||||
NAME="AEN2988"
|
||||
></A
|
||||
>Chapter 5. Storages, folders, messages</H1
|
||||
><DIV
|
||||
CLASS="TOC"
|
||||
><DL
|
||||
><DT
|
||||
><B
|
||||
>Table of Contents</B
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="c2988.htm#AEN2990"
|
||||
>Introduction</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x3011.htm"
|
||||
>Error codes</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x3015.htm"
|
||||
>Storage</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x3082.htm"
|
||||
>Folder</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x3198.htm"
|
||||
>Message</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x3472.htm"
|
||||
>Session</A
|
||||
></DT
|
||||
></DL
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="AEN2990"
|
||||
>Introduction</A
|
||||
></H1
|
||||
><P
|
||||
> This part will give the definition of some objects.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="AEN2993"
|
||||
>Message</A
|
||||
></H2
|
||||
><P
|
||||
> A message is the common e-mail message or news message you
|
||||
read or send.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="AEN2996"
|
||||
>MIME part</A
|
||||
></H2
|
||||
><P
|
||||
> A message can have attachment such as images or other documents.
|
||||
The attachment are organized into a tree structure. Each
|
||||
node of this structure is a MIME part.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="AEN2999"
|
||||
>Mailbox</A
|
||||
></H2
|
||||
><P
|
||||
> A mailbox will contain a given number of messages.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="AEN3002"
|
||||
>Storage</A
|
||||
></H2
|
||||
><P
|
||||
> A storage is a "physical" localisation of your mailbox. This
|
||||
can be on a filesystem (local or remote disk, this is the
|
||||
case of MH, mbox and maildir), or this can be on a remote
|
||||
host (this is the case for POP3, IMAP or NNTP).
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="AEN3005"
|
||||
>Folder</A
|
||||
></H2
|
||||
><P
|
||||
> A storage, for the same user, can contain a given number of
|
||||
mailboxes, depending the storage capabilities, then, the
|
||||
storage driver capabilities. With etPan!, MH, IMAP and NNTP
|
||||
storages can have more than one mailbox. The mailboxes will
|
||||
be called folders. On storage where we only have one
|
||||
mailbox, the unique mailbox is the unique folder.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="AEN3008"
|
||||
>Session</A
|
||||
></H2
|
||||
><P
|
||||
> The session is the network connection or the entity to which
|
||||
the commands of the drivers are given.
|
||||
</P
|
||||
></DIV
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x2946.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.htm"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x3011.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Helper functions</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Error codes</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
342
libs/libetpan/doc/API/c385.htm
Normal file
342
libs/libetpan/doc/API/c385.htm
Normal file
@@ -0,0 +1,342 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Internet Message Format</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="libEtPan! API"
|
||||
HREF="book1.htm"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="strings"
|
||||
HREF="x312.htm"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Data types"
|
||||
HREF="x425.htm"></HEAD
|
||||
><BODY
|
||||
CLASS="CHAPTER"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>libEtPan! API</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x312.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x425.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="CHAPTER"
|
||||
><H1
|
||||
><A
|
||||
NAME="IMF"
|
||||
></A
|
||||
>Chapter 3. Internet Message Format</H1
|
||||
><DIV
|
||||
CLASS="TOC"
|
||||
><DL
|
||||
><DT
|
||||
><B
|
||||
>Table of Contents</B
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="c385.htm#AEN397"
|
||||
>Quick start</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x425.htm"
|
||||
>Data types</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x1094.htm"
|
||||
>Parser functions</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x1381.htm"
|
||||
>Creation functions</A
|
||||
></DT
|
||||
><DT
|
||||
><A
|
||||
HREF="x1556.htm"
|
||||
>Rendering of messages</A
|
||||
></DT
|
||||
></DL
|
||||
></DIV
|
||||
><P
|
||||
> libEtPan! implements Internet Message parser. Currently, format
|
||||
is RFC 2822.
|
||||
This module also allows to generate messages.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="WARNING"
|
||||
><P
|
||||
></P
|
||||
><TABLE
|
||||
CLASS="WARNING"
|
||||
BORDER="1"
|
||||
WIDTH="100%"
|
||||
><TR
|
||||
><TD
|
||||
ALIGN="CENTER"
|
||||
><B
|
||||
>Warning</B
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
ALIGN="LEFT"
|
||||
><P
|
||||
> All allocation functions will take as argument allocated data
|
||||
and will store these data in the structure they will allocate.
|
||||
Data should be persistant during all the use of the structure
|
||||
and will be freed by the free function of the structure
|
||||
</P
|
||||
><P
|
||||
> allocation functions will return <B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> on failure
|
||||
|
||||
functions returning integer will be returning one of the
|
||||
following error code:
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>MAILIMF_NO_ERROR</B
|
||||
>,
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>MAILIMF_ERROR_PARSE</B
|
||||
>,
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>MAILIMF_ERROR_MEMORY</B
|
||||
>,
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>MAILIMF_ERROR_INVAL</B
|
||||
>,
|
||||
or <B
|
||||
CLASS="COMMAND"
|
||||
>MAILIMF_ERROR_FILE</B
|
||||
>.
|
||||
</P
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="AEN397"
|
||||
>Quick start</A
|
||||
></H1
|
||||
><P
|
||||
> You will need this module when you want to parse headers
|
||||
of messages or when you want to build message headers
|
||||
conformant to standards.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="AEN400"
|
||||
>Parse message headers</A
|
||||
></H2
|
||||
><P
|
||||
> You will use one of the four following functions, depending
|
||||
on your needs :
|
||||
</P
|
||||
><P
|
||||
></P
|
||||
><UL
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_envelope_and_optional_fields_parse</B
|
||||
>
|
||||
(<A
|
||||
HREF="x1094.htm#MAILIMF-ENVELOPE-AND-OPTIONAL-FIELDS-PARSE"
|
||||
>the Section called <I
|
||||
>mailimf_envelope_and_optional_fields_parse</I
|
||||
></A
|
||||
>),
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_envelope_fields_parse</B
|
||||
>
|
||||
(<A
|
||||
HREF="x1094.htm#MAILIMF-ENVELOPE-FIELDS-PARSE"
|
||||
>the Section called <I
|
||||
>mailimf_envelope_fields_parse</I
|
||||
></A
|
||||
>),
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_optional_fields_parse</B
|
||||
>
|
||||
(<A
|
||||
HREF="x1094.htm#MAILIMF-OPTIONAL-FIELDS-PARSE"
|
||||
>the Section called <I
|
||||
>mailimf_optional_fields_parse</I
|
||||
></A
|
||||
>),
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_fields_parse</B
|
||||
>
|
||||
(<A
|
||||
HREF="x1094.htm#MAILIMF-FIELDS-PARSE"
|
||||
>the Section called <I
|
||||
>mailimf_fields_parse</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
></UL
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="AEN420"
|
||||
>Render the message headers</A
|
||||
></H2
|
||||
><P
|
||||
> Build your message headers, then use
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_fields_write</B
|
||||
>
|
||||
(<A
|
||||
HREF="x1556.htm#MAILIMF-FIELDS-WRITE"
|
||||
>the Section called <I
|
||||
>Header fields</I
|
||||
></A
|
||||
>)
|
||||
to render the headers.
|
||||
</P
|
||||
></DIV
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x312.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.htm"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x425.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>strings</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
> </TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Data types</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
1683
libs/libetpan/doc/API/x1094.htm
Normal file
1683
libs/libetpan/doc/API/x1094.htm
Normal file
File diff suppressed because it is too large
Load Diff
955
libs/libetpan/doc/API/x1381.htm
Normal file
955
libs/libetpan/doc/API/x1381.htm
Normal file
@@ -0,0 +1,955 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Creation functions</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="libEtPan! API"
|
||||
HREF="book1.htm"><LINK
|
||||
REL="UP"
|
||||
TITLE="Internet Message Format"
|
||||
HREF="c385.htm"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Parser functions"
|
||||
HREF="x1094.htm"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Rendering of messages"
|
||||
HREF="x1556.htm"></HEAD
|
||||
><BODY
|
||||
CLASS="SECT1"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>libEtPan! API</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x1094.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
>Chapter 3. Internet Message Format</TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x1556.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="AEN1381"
|
||||
>Creation functions</A
|
||||
></H1
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILIMF-MAILBOX-LIST-ADD"
|
||||
>mailimf_mailbox_list</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
struct mailimf_mailbox_list *
|
||||
mailimf_mailbox_list_new_empty();
|
||||
|
||||
int mailimf_mailbox_list_add(struct mailimf_mailbox_list * mailbox_list,
|
||||
struct mailimf_mailbox * mb);
|
||||
|
||||
int mailimf_mailbox_list_add_parse(struct mailimf_mailbox_list * mailbox_list,
|
||||
char * mb_str);
|
||||
|
||||
int mailimf_mailbox_list_add_mb(struct mailimf_mailbox_list * mailbox_list,
|
||||
char * display_name, char * address);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_mailbox_list_new_empty()</B
|
||||
> creates a
|
||||
new empty list of mailboxes.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_mailbox_list_add</B
|
||||
> adds a mailbox
|
||||
to the list of mailboxes.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_mailbox_list_add_parse</B
|
||||
> adds a
|
||||
mailbox given in form of a string to the list of mailboxes.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_mailbox_list_add_mb</B
|
||||
> adds a
|
||||
mailbox given in form of a couple : display name, mailbox
|
||||
address.
|
||||
</P
|
||||
><P
|
||||
></P
|
||||
><UL
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailbox_list</B
|
||||
> is the list of mailboxes.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mb</B
|
||||
> is a mailbox
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-MAILBOX"
|
||||
>the Section called <I
|
||||
>mailimf_mailbox - mailbox</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mb_str</B
|
||||
> is a mailbox given in the form
|
||||
of a string.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>display_name</B
|
||||
> is the display name.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>address</B
|
||||
> is the mailbox address.
|
||||
</P
|
||||
></LI
|
||||
></UL
|
||||
><DIV
|
||||
CLASS="EXAMPLE"
|
||||
><A
|
||||
NAME="AEN1411"
|
||||
></A
|
||||
><P
|
||||
><B
|
||||
>Example 3-44. creating a list of mailboxes</B
|
||||
></P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
struct mailimf_mailbox_list * mb_list;
|
||||
struct mailimf_mailbox * mb;
|
||||
|
||||
mb_list = mailimf_mailbox_list_new_empty();
|
||||
|
||||
mb = mailimf_mailbox_new(strdup("DINH Viet Hoa"),
|
||||
strdup("dinh.viet.hoa@free.fr"));
|
||||
mailimf_mailbox_list_add(mb_list, mb);
|
||||
|
||||
mailimf_mailbox_list_add_parse(mb_list, "foo bar <foo@bar.org>");
|
||||
|
||||
mailimf_mailbox_list_add_mb(mb_list, strdup("bar foo"), strdup("bar@foo.com"));
|
||||
|
||||
mailimf_mailbox_list_free(mb_list);
|
||||
}
|
||||
</PRE
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILIMF-ADDRESS-LIST-ADD"
|
||||
>mailimf_address_list</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
struct mailimf_address_list * mailimf_address_list_new_empty();
|
||||
|
||||
int mailimf_address_list_add(struct mailimf_address_list * address_list,
|
||||
struct mailimf_address * addr);
|
||||
|
||||
int mailimf_address_list_add_parse(struct mailimf_address_list * address_list,
|
||||
char * addr_str);
|
||||
|
||||
int mailimf_address_list_add_mb(struct mailimf_address_list * address_list,
|
||||
char * display_name, char * address);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_address_list_new_empty()</B
|
||||
> creates a
|
||||
new empty list of addresses.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_address_list_add</B
|
||||
> adds an address
|
||||
to the list of addresses.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_address_list_add_parse</B
|
||||
> adds an
|
||||
address given in form of a string to the list of addresses.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_address_list_add_mb</B
|
||||
> adds a
|
||||
mailbox given in form of a couple : display name, mailbox
|
||||
address.
|
||||
</P
|
||||
><P
|
||||
></P
|
||||
><UL
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>address_list</B
|
||||
> is the list of mailboxes.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>addr</B
|
||||
> is an address.
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-ADDRESS"
|
||||
>the Section called <I
|
||||
>mailimf_address - address</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>addr_str</B
|
||||
> is an address given in the form of a
|
||||
string.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>display_name</B
|
||||
> is the display name.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>address</B
|
||||
> is the mailbox address.
|
||||
</P
|
||||
></LI
|
||||
></UL
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILIMF-FIELDS-ADD"
|
||||
>mailimf_fields</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
struct mailimf_fields *
|
||||
mailimf_fields_new_empty(void);
|
||||
|
||||
struct mailimf_field * mailimf_field_new_custom(char * name, char * value);
|
||||
|
||||
int mailimf_fields_add(struct mailimf_fields * fields,
|
||||
struct mailimf_field * field);
|
||||
|
||||
int mailimf_fields_add_data(struct mailimf_fields * fields,
|
||||
struct mailimf_date_time * date,
|
||||
struct mailimf_mailbox_list * from,
|
||||
struct mailimf_mailbox * sender,
|
||||
struct mailimf_address_list * reply_to,
|
||||
struct mailimf_address_list * to,
|
||||
struct mailimf_address_list * cc,
|
||||
struct mailimf_address_list * bcc,
|
||||
char * msg_id,
|
||||
clist * in_reply_to,
|
||||
clist * references,
|
||||
char * subject);
|
||||
|
||||
struct mailimf_fields *
|
||||
mailimf_fields_new_with_data_all(struct mailimf_date_time * date,
|
||||
struct mailimf_mailbox_list * from,
|
||||
struct mailimf_mailbox * sender,
|
||||
struct mailimf_address_list * reply_to,
|
||||
struct mailimf_address_list * to,
|
||||
struct mailimf_address_list * cc,
|
||||
struct mailimf_address_list * bcc,
|
||||
char * message_id,
|
||||
clist * in_reply_to,
|
||||
clist * references,
|
||||
char * subject);
|
||||
|
||||
struct mailimf_fields *
|
||||
mailimf_fields_new_with_data(struct mailimf_mailbox_list * from,
|
||||
struct mailimf_mailbox * sender,
|
||||
struct mailimf_address_list * reply_to,
|
||||
struct mailimf_address_list * to,
|
||||
struct mailimf_address_list * cc,
|
||||
struct mailimf_address_list * bcc,
|
||||
clist * in_reply_to,
|
||||
clist * references,
|
||||
char * subject);
|
||||
|
||||
char * mailimf_get_message_id(void);
|
||||
|
||||
struct mailimf_date_time * mailimf_get_current_date(void);
|
||||
|
||||
int
|
||||
mailimf_resent_fields_add_data(struct mailimf_fields * fields,
|
||||
struct mailimf_date_time * resent_date,
|
||||
struct mailimf_mailbox_list * resent_from,
|
||||
struct mailimf_mailbox * resent_sender,
|
||||
struct mailimf_address_list * resent_to,
|
||||
struct mailimf_address_list * resent_cc,
|
||||
struct mailimf_address_list * resent_bcc,
|
||||
char * resent_msg_id);
|
||||
|
||||
struct mailimf_fields *
|
||||
mailimf_resent_fields_new_with_data_all(struct mailimf_date_time *
|
||||
resent_date, struct mailimf_mailbox_list * resent_from,
|
||||
struct mailimf_mailbox * resent_sender,
|
||||
struct mailimf_address_list * resent_to,
|
||||
struct mailimf_address_list * resent_cc,
|
||||
struct mailimf_address_list * resent_bcc,
|
||||
char * resent_msg_id);
|
||||
|
||||
struct mailimf_fields *
|
||||
mailimf_resent_fields_new_with_data(struct mailimf_mailbox_list * from,
|
||||
struct mailimf_mailbox * resent_sender,
|
||||
struct mailimf_address_list * resent_to,
|
||||
struct mailimf_address_list * resent_cc,
|
||||
struct mailimf_address_list * resent_bcc);
|
||||
</PRE
|
||||
><P
|
||||
></P
|
||||
><UL
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>from</B
|
||||
> is the parsed content of the
|
||||
From field
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-FROM"
|
||||
>the Section called <I
|
||||
>mailimf_from - parsed content of From header</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>sender</B
|
||||
> is the parsed content of the
|
||||
Sender field
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-SENDER"
|
||||
>the Section called <I
|
||||
>mailimf_sender - parsed content of Sender header</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>reply_to</B
|
||||
> is the parsed content of the
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>Reply-To</B
|
||||
> field
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-REPLY-TO"
|
||||
>the Section called <I
|
||||
>mailimf_reply_to - parsed content of Reply-To header</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>to</B
|
||||
> is the parsed content of the
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>To</B
|
||||
> field
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-TO"
|
||||
>the Section called <I
|
||||
>mailimf_to - parsed content of To header</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>cc</B
|
||||
> is the parsed content of the
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>Cc</B
|
||||
> field
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-CC"
|
||||
>the Section called <I
|
||||
>mailimf_cc - parsed content of Cc</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>bcc</B
|
||||
> is the parsed content of the
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>Bcc</B
|
||||
> field
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-BCC"
|
||||
>the Section called <I
|
||||
>mailimf_bcc - parsed content of Bcc field</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>message_id</B
|
||||
> is the parsed content of
|
||||
the <B
|
||||
CLASS="COMMAND"
|
||||
>Message-ID</B
|
||||
> field
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-MESSAGE-ID"
|
||||
>the Section called <I
|
||||
>mailimf_message_id - parsed content of Message-ID header</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>in_reply_to</B
|
||||
> is the parsed content of
|
||||
the <B
|
||||
CLASS="COMMAND"
|
||||
>In-Reply-To</B
|
||||
> field
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-IN-REPLY-TO"
|
||||
>the Section called <I
|
||||
>mailimf_in_reply_to - parsed content of In-Reply-To
|
||||
field</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>references</B
|
||||
> is the parsed content of
|
||||
the <B
|
||||
CLASS="COMMAND"
|
||||
>References</B
|
||||
> field
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-REFERENCES"
|
||||
>the Section called <I
|
||||
>mailimf_references - parsed content of References field</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>subject</B
|
||||
> is the content of the
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>Subject</B
|
||||
> field
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-SUBJECT"
|
||||
>the Section called <I
|
||||
>mailimf_subject - parsed content of Subject field</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>resent_date</B
|
||||
> is the parsed content of
|
||||
the <B
|
||||
CLASS="COMMAND"
|
||||
>Resent-Date</B
|
||||
> field
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-ORIG-DATE"
|
||||
>the Section called <I
|
||||
>mailimf_orig_date - parsed content of date header</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>resent_from</B
|
||||
> is the parsed content of
|
||||
the <B
|
||||
CLASS="COMMAND"
|
||||
>Resent-From</B
|
||||
> field
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-FROM"
|
||||
>the Section called <I
|
||||
>mailimf_from - parsed content of From header</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>resent_sender</B
|
||||
> is the parsed content of the
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>Resent-Sender</B
|
||||
> field
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-SENDER"
|
||||
>the Section called <I
|
||||
>mailimf_sender - parsed content of Sender header</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>resent_to</B
|
||||
> is the parsed content of
|
||||
the <B
|
||||
CLASS="COMMAND"
|
||||
>Resent-To</B
|
||||
> field
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-TO"
|
||||
>the Section called <I
|
||||
>mailimf_to - parsed content of To header</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>resent_cc</B
|
||||
> is the parsed content of
|
||||
the <B
|
||||
CLASS="COMMAND"
|
||||
>Resent-Cc</B
|
||||
> field
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-CC"
|
||||
>the Section called <I
|
||||
>mailimf_cc - parsed content of Cc</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>resent_bcc</B
|
||||
> is the parsed content of the
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>Resent-Bcc</B
|
||||
> field
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-BCC"
|
||||
>the Section called <I
|
||||
>mailimf_bcc - parsed content of Bcc field</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>resent_msg_id</B
|
||||
> is the parsed content of the
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>Resent-Message-ID</B
|
||||
> field
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-MESSAGE-ID"
|
||||
>the Section called <I
|
||||
>mailimf_message_id - parsed content of Message-ID header</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
></UL
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_fields_new_empty()</B
|
||||
> creates a new
|
||||
empty set of headers.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_field_new_custom()</B
|
||||
> creates a new
|
||||
custom header.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_fields_add()</B
|
||||
> adds a header to the
|
||||
set of headers.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_fields_add_data()</B
|
||||
> adds some headers
|
||||
to the set of headers.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_fields_new_with_data_all()</B
|
||||
> creates
|
||||
a set of headers with some headers (including Date and
|
||||
Message-ID).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_fields_new_with_data()</B
|
||||
> creates a
|
||||
set of headers with some headers (Date and Message-ID will
|
||||
be generated).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_get_message_id()</B
|
||||
> generates a
|
||||
Message-ID. The result must be freed using
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>free()</B
|
||||
>.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_get_current_date()</B
|
||||
> generates a
|
||||
Date. The result must be freed using
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_date_time_free</B
|
||||
>.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_resent_fields_add_data()</B
|
||||
> adds some
|
||||
resent headers to the set of headers.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_resent_fields_new_with_data_all()</B
|
||||
>
|
||||
creates a set of headers with some resent headers (including
|
||||
Resent-Date and Resent-Message-ID).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_resent_fields_new_with_data()</B
|
||||
>
|
||||
creates a set of headers with some resent headers
|
||||
(Resent-Date and Resent-Message-ID will be generated)
|
||||
</P
|
||||
><DIV
|
||||
CLASS="EXAMPLE"
|
||||
><A
|
||||
NAME="AEN1553"
|
||||
></A
|
||||
><P
|
||||
><B
|
||||
>Example 3-45. creation of header fields</B
|
||||
></P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
struct mailimf_fields * fields;
|
||||
struct mailimf_field * field;
|
||||
struct mailimf_date_time * date;
|
||||
char * msg_id;
|
||||
struct mailimf_mailbox_list * from;
|
||||
struct mailimf_address_list * to;
|
||||
|
||||
fields = mailimf_fields_new_empty();
|
||||
field = mailimf_field_new_custom(strdup("X-Mailer"), strdup("my-mailer"));
|
||||
mailimf_fields_add(fields, field);
|
||||
|
||||
from = mailimf_mailbox_list_new_empty();
|
||||
mailimf_mailbox_list_add_mb(from, strdup("DINH Viet Hoa"), strdup("dinh.viet.hoa@free.fr");
|
||||
date = mailimf_get_current_date();
|
||||
msg_id = mailimf_get_message_id();
|
||||
to = mailimf_address_list_new_empty();
|
||||
mailimf_address_list_add_mb(to, strdup("FOO Bar"), strdup("foo@bar.org");
|
||||
|
||||
mailimf_fields_add_data(fields, date, from, NULL, NULL, to, NULL, NULL,
|
||||
msg_id, NULL, NULL, strdup("hello"));
|
||||
|
||||
/* do the things */
|
||||
|
||||
mailimf_fields_free(fields);
|
||||
}
|
||||
|
||||
#include <libetpan/libetpan.h>
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
struct mailimf_fields * fields;
|
||||
struct mailimf_mailbox_list * from;
|
||||
struct mailimf_address_list * to;
|
||||
struct mailimf_date_time * date;
|
||||
char * msg_id;
|
||||
|
||||
from = mailimf_mailbox_list_new_empty();
|
||||
mailimf_mailbox_list_add_mb(from, strdup("DINH Viet Hoa"), strdup("dinh.viet.hoa@free.fr");
|
||||
to = mailimf_address_list_new_empty();
|
||||
mailimf_address_list_add_mb(to, strdup("FOO Bar"), strdup("foo@bar.org");
|
||||
date = mailimf_get_current_date();
|
||||
msg_id = mailimf_get_message_id();
|
||||
|
||||
fields = mailimf_fields_new_with_all_data(date, from, NULL, NULL, to, NULL, NULL,
|
||||
msg_id, NULL, NULL, strdup("hello"));
|
||||
|
||||
/* do the things */
|
||||
|
||||
mailimf_fields_free(fields);
|
||||
}
|
||||
|
||||
#include <libetpan/libetpan.h>
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
struct mailimf_fields * fields;
|
||||
struct mailimf_mailbox_list * from;
|
||||
struct mailimf_address_list * to;
|
||||
|
||||
from = mailimf_mailbox_list_new_empty();
|
||||
mailimf_mailbox_list_add_mb(from, strdup("DINH Viet Hoa"), strdup("dinh.viet.hoa@free.fr");
|
||||
to = mailimf_address_list_new_empty();
|
||||
mailimf_address_list_add_mb(to, strdup("FOO Bar"), strdup("foo@bar.org");
|
||||
|
||||
fields = mailimf_fields_new_with_data(from, NULL, NULL, to, NULL, NULL,
|
||||
NULL, NULL, strdup("hello"));
|
||||
|
||||
/* do the things */
|
||||
|
||||
mailimf_fields_free(fields);
|
||||
}
|
||||
</PRE
|
||||
></DIV
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x1094.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.htm"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x1556.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Parser functions</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="c385.htm"
|
||||
ACCESSKEY="U"
|
||||
>Up</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Rendering of messages</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
295
libs/libetpan/doc/API/x1556.htm
Normal file
295
libs/libetpan/doc/API/x1556.htm
Normal file
@@ -0,0 +1,295 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Rendering of messages</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="libEtPan! API"
|
||||
HREF="book1.htm"><LINK
|
||||
REL="UP"
|
||||
TITLE="Internet Message Format"
|
||||
HREF="c385.htm"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Creation functions"
|
||||
HREF="x1381.htm"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="MIME"
|
||||
HREF="c1586.htm"></HEAD
|
||||
><BODY
|
||||
CLASS="SECT1"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>libEtPan! API</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x1381.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
>Chapter 3. Internet Message Format</TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="c1586.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="AEN1556"
|
||||
>Rendering of messages</A
|
||||
></H1
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILIMF-FIELDS-WRITE"
|
||||
>Header fields</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
int mailimf_fields_write(FILE * f, int * col,
|
||||
struct mailimf_fields * fields);
|
||||
|
||||
int mailimf_envelope_fields_write(FILE * f, int * col,
|
||||
struct mailimf_fields * fields);
|
||||
|
||||
int mailimf_field_write(FILE * f, int * col,
|
||||
struct mailimf_field * field);
|
||||
</PRE
|
||||
><P
|
||||
></P
|
||||
><UL
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>col</B
|
||||
> current column is given for wrapping
|
||||
purpose in <B
|
||||
CLASS="COMMAND"
|
||||
>(* col)</B
|
||||
>,
|
||||
the resulting columns will be returned..
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>f</B
|
||||
> is the file descriptor. It can be
|
||||
stdout for example.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>fields</B
|
||||
> is the header fields
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-FIELDS"
|
||||
>the Section called <I
|
||||
>mailimf_fields - list of header fields</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>field</B
|
||||
> is a field
|
||||
(see <A
|
||||
HREF="x425.htm#MAILIMF-FIELD"
|
||||
>the Section called <I
|
||||
>mailimf_field - header field</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
></UL
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_fields_write</B
|
||||
> outputs the set of
|
||||
header fields.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_envelope_fields_write</B
|
||||
> outputs the
|
||||
set of header fields except the optional fields.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailimf_field_write</B
|
||||
> outputs a header.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="EXAMPLE"
|
||||
><A
|
||||
NAME="AEN1583"
|
||||
></A
|
||||
><P
|
||||
><B
|
||||
>Example 3-46. rendering of fields</B
|
||||
></P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int main(int argc, char ** argv)
|
||||
{
|
||||
struct mailimf_fields * fields;
|
||||
int col;
|
||||
|
||||
/* look at the example in mailimf_fields to see how to
|
||||
build a mailimf_fields */
|
||||
fields = build_imf_fields();
|
||||
|
||||
col = 0;
|
||||
mailimf_fields_write(stdout, &col, fields);
|
||||
|
||||
mailimf_fields_free(fields);
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
struct mailimf_fields * fields;
|
||||
int col;
|
||||
|
||||
/* look at the example in mailimf_fields to see how to
|
||||
build a mailimf_fields */
|
||||
fields = build_imf_fields();
|
||||
|
||||
col = 0;
|
||||
mailimf_envelope_fields_write(stdout, &col, fields);
|
||||
|
||||
mailimf_fields_free(fields);
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
struct mailimf_field * field;
|
||||
int col;
|
||||
|
||||
field = mailimf_field_new_custom(strdup("X-Mailer"), strdup("my mailer"));
|
||||
|
||||
col = 0;
|
||||
mailimf_field_write(stdout, &col, field);
|
||||
|
||||
mailimf_field_free(field);
|
||||
}
|
||||
</PRE
|
||||
></DIV
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x1381.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.htm"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="c1586.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Creation functions</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="c385.htm"
|
||||
ACCESSKEY="U"
|
||||
>Up</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>MIME</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
557
libs/libetpan/doc/API/x161.htm
Normal file
557
libs/libetpan/doc/API/x161.htm
Normal file
@@ -0,0 +1,557 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Hash table</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="libEtPan! API"
|
||||
HREF="book1.htm"><LINK
|
||||
REL="UP"
|
||||
TITLE="Tools and datatypes"
|
||||
HREF="c16.htm"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="List"
|
||||
HREF="x88.htm"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Buffered I/O"
|
||||
HREF="x229.htm"></HEAD
|
||||
><BODY
|
||||
CLASS="SECT1"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>libEtPan! API</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x88.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
>Chapter 2. Tools and datatypes</TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x229.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="AEN161"
|
||||
>Hash table</A
|
||||
></H1
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
typedef struct chash chash;
|
||||
|
||||
typedef struct chashcell chashiter;
|
||||
|
||||
typedef struct {
|
||||
char * data;
|
||||
int len;
|
||||
} chashdatum;
|
||||
</PRE
|
||||
><P
|
||||
>
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>chash</B
|
||||
> is a hash table.
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>chashiter</B
|
||||
> is a pointer to an element of the
|
||||
hash table.
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>chashdatum</B
|
||||
> is an element to be placed in
|
||||
the hash table as a key or a value. It consists in
|
||||
data and a corresponding length.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="CHASH-NEW"
|
||||
>chash_new and chash_free</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#define CHASH_COPYNONE 0
|
||||
#define CHASH_COPYKEY 1
|
||||
#define CHASH_COPYVALUE 2
|
||||
#define CHASH_COPYALL (CHASH_COPYKEY | CHASH_COPYVALUE)
|
||||
|
||||
chash * chash_new(int size, int flags);
|
||||
|
||||
void chash_free(chash * hash);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>chash_new()</B
|
||||
> returns a new empty hash table
|
||||
or <B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> if this
|
||||
failed. <B
|
||||
CLASS="COMMAND"
|
||||
>size</B
|
||||
> is the initial size of the
|
||||
table used for implementation. <B
|
||||
CLASS="COMMAND"
|
||||
>flags</B
|
||||
> can
|
||||
be a combinaison of <B
|
||||
CLASS="COMMAND"
|
||||
>CHASH_COPYKEY</B
|
||||
> and
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>CHASH_COPYVALUE</B
|
||||
>.
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>CHASH_COPYKEY</B
|
||||
> enables copy of key, so
|
||||
that the initial value used for <B
|
||||
CLASS="COMMAND"
|
||||
>chash_set()</B
|
||||
>
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>chash_free()</B
|
||||
> releases memory used by the
|
||||
hash table.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="CHASH-GET"
|
||||
>chash_set and chash_get</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int chash_set(chash * hash,
|
||||
chashdatum * key, chashdatum * value, chashdatum * oldvalue);
|
||||
|
||||
int chash_get(chash * hash,
|
||||
chashdatum * key, chashdatum * result);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>chash_set()</B
|
||||
> adds a new element into the
|
||||
hash table. If a previous element had the same key, it is
|
||||
returns into oldvalue if <B
|
||||
CLASS="COMMAND"
|
||||
>oldvalue</B
|
||||
> is
|
||||
different of NULL.
|
||||
Medium complexity is O(1).
|
||||
</P
|
||||
><P
|
||||
> returns -1 if it fails, 0 on success.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>chash_get()</B
|
||||
>returns the corresponding value
|
||||
of the given key. If there is no corresponding value, -1 is
|
||||
returned. 0 on success.
|
||||
Medium complexity is O(1).
|
||||
</P
|
||||
><DIV
|
||||
CLASS="EXAMPLE"
|
||||
><A
|
||||
NAME="AEN191"
|
||||
></A
|
||||
><P
|
||||
><B
|
||||
>Example 2-9. chash insert and lookup</B
|
||||
></P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int main(void)
|
||||
{
|
||||
chash * hash;
|
||||
int r;
|
||||
chashdatum key;
|
||||
chashdatum value;
|
||||
char * str1 = "my-data";
|
||||
char * str2 = "my-data";
|
||||
|
||||
hash = chash_new(CHASH_DEFAULTSIZE, CHASH_COPYNONE);
|
||||
|
||||
key.data = "foo";
|
||||
key.len = strlen("foo");
|
||||
value.data = str1;
|
||||
value.data = strlen(str1) + 1;
|
||||
/* + 1 is needed to get the terminal zero in the returned string */
|
||||
r = chash_set(hash, &key, &value, NULL);
|
||||
if (r < 0)
|
||||
goto free_hash;
|
||||
|
||||
key.data = "bar";
|
||||
key.len = strlen("bar");
|
||||
value.data = str2;
|
||||
value.data = strlen(str2) + 1;
|
||||
if (r < 0)
|
||||
goto free_hash;
|
||||
|
||||
key.data = "foo";
|
||||
key.len = strlen("foo");
|
||||
r = chash_get(hash, &key, &value);
|
||||
if (r < 0) {
|
||||
printf("element not found\n");
|
||||
}
|
||||
else {
|
||||
char * str;
|
||||
|
||||
str = value.data;
|
||||
printf("found : %s", str);
|
||||
}
|
||||
|
||||
chash_free(hash);
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
free_hash:
|
||||
chash_free(hash);
|
||||
err:
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
</PRE
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="CHASH-DELETE"
|
||||
>chash_delete</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int chash_delete(chash * hash,
|
||||
chashdatum * key, chashdatum * oldvalue);
|
||||
</PRE
|
||||
><P
|
||||
> deletes the key/value pair given the corresponding key.
|
||||
The value is returned in old_value.
|
||||
If there is no corresponding value, -1 is returned. 0 on success.
|
||||
Medium complexity is O(1).
|
||||
</P
|
||||
><DIV
|
||||
CLASS="EXAMPLE"
|
||||
><A
|
||||
NAME="AEN198"
|
||||
></A
|
||||
><P
|
||||
><B
|
||||
>Example 2-10. key deletion in a chash</B
|
||||
></P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int main(void)
|
||||
{
|
||||
chash * hash;
|
||||
int r;
|
||||
chashdatum key;
|
||||
chashdatum value;
|
||||
char * str1 = "my-data";
|
||||
char * str2 = "my-data";
|
||||
|
||||
hash = build_hash();
|
||||
|
||||
key.data = "foo";
|
||||
key.len = strlen("foo");
|
||||
chash_delete(hash, &key, &value);
|
||||
|
||||
/* it will never be possible to lookup "foo" */
|
||||
key.data = "foo";
|
||||
key.len = strlen("foo");
|
||||
r = chash_get(hash, &key, &value);
|
||||
if (r < 0) {
|
||||
printf("element not found\n");
|
||||
}
|
||||
else {
|
||||
char * str;
|
||||
|
||||
str = value.data;
|
||||
printf("found : %s", str);
|
||||
}
|
||||
|
||||
chash_free(hash);
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
free_hash:
|
||||
chash_free(hash);
|
||||
err:
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
</PRE
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="CHASH-RESIZE"
|
||||
>chash_resize</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int chash_resize(chash * hash, int size);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>chash_resize()</B
|
||||
> changes the size of the
|
||||
table used for implementation of the hash table.
|
||||
returns 0 on success, -1 on failure.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="CHASH-BEGIN"
|
||||
>running through the chash</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>chashiter * chash_begin(chash * hash);
|
||||
|
||||
chashiter * chash_next(chash * hash, chashiter * iter);
|
||||
|
||||
void chash_key(chashiter * iter, chashdatum * result);
|
||||
|
||||
void chash_value(chashiter iter, chashdatum * result);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>chash_begin()</B
|
||||
> returns a pointer to the
|
||||
first element of the hash table. Returns
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> if there is no elements in the hash
|
||||
table.
|
||||
Complexity is O(n).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>chash_next()</B
|
||||
> returns a pointer to the next
|
||||
element of the hash table. Returns <B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
>
|
||||
if there is no next element.
|
||||
Complexity is O(n) but n calls to chash_next() also has
|
||||
a complexity of O(n).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>chash_key()</B
|
||||
> returns the key of the given
|
||||
element of the hash table.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>chash_value</B
|
||||
> returns the value of the
|
||||
given element of the hash table.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="EXAMPLE"
|
||||
><A
|
||||
NAME="AEN219"
|
||||
></A
|
||||
><P
|
||||
><B
|
||||
>Example 2-11. running through a chash</B
|
||||
></P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int main(void)
|
||||
{
|
||||
chash * hash;
|
||||
int r;
|
||||
chashiter * iter;
|
||||
|
||||
hash = build_hash();
|
||||
|
||||
/* this will display all the values stored in the hash */
|
||||
for(iter = chash_begin(hash) ; iter != NULL ; iter =
|
||||
chash_next(hash, iter)) {
|
||||
chashdatum key;
|
||||
chashdatum value;
|
||||
char * str;
|
||||
|
||||
chash_value(iter, &value);
|
||||
str = value.data;
|
||||
printf("%s\n", str);
|
||||
}
|
||||
|
||||
chash_free(hash);
|
||||
}
|
||||
</PRE
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="CHASH-COUNT"
|
||||
>chash_size and chash_count</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int chash_size(chash * hash);
|
||||
|
||||
int chash_count(chash * hash);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>chash_size()</B
|
||||
> returns the size of the table
|
||||
used for implementation of the hash table.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>chash_count()</B
|
||||
> returns the number of
|
||||
elements in the hash table.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x88.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.htm"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x229.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>List</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="c16.htm"
|
||||
ACCESSKEY="U"
|
||||
>Up</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Buffered I/O</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
3534
libs/libetpan/doc/API/x1614.htm
Normal file
3534
libs/libetpan/doc/API/x1614.htm
Normal file
File diff suppressed because it is too large
Load Diff
2536
libs/libetpan/doc/API/x2180.htm
Normal file
2536
libs/libetpan/doc/API/x2180.htm
Normal file
File diff suppressed because it is too large
Load Diff
407
libs/libetpan/doc/API/x229.htm
Normal file
407
libs/libetpan/doc/API/x229.htm
Normal file
@@ -0,0 +1,407 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Buffered I/O</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="libEtPan! API"
|
||||
HREF="book1.htm"><LINK
|
||||
REL="UP"
|
||||
TITLE="Tools and datatypes"
|
||||
HREF="c16.htm"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Hash table"
|
||||
HREF="x161.htm"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="non-buffered I/O"
|
||||
HREF="x289.htm"></HEAD
|
||||
><BODY
|
||||
CLASS="SECT1"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>libEtPan! API</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x161.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
>Chapter 2. Tools and datatypes</TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x289.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="AEN229"
|
||||
>Buffered I/O</A
|
||||
></H1
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>
|
||||
#include <libetpan/libetpan.h>
|
||||
|
||||
typedef struct _mailstream mailstream;
|
||||
</PRE
|
||||
><P
|
||||
> streams are objects where we can read data from and write data
|
||||
to. They are not seekable. That can be for example a pipe or a
|
||||
network stream.
|
||||
</P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>mailstream * mailstream_new(mailstream_low * low, size_t buffer_size);
|
||||
|
||||
int mailstream_close(mailstream * s);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_new()</B
|
||||
> creates a new stream
|
||||
stream with the low-level (see <A
|
||||
HREF="x289.htm"
|
||||
>the Section called <I
|
||||
>non-buffered I/O</I
|
||||
></A
|
||||
>)
|
||||
stream and a given buffer size.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_close()</B
|
||||
> closes the stream.
|
||||
This function will be in charge to free the
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_low</B
|
||||
> structure.
|
||||
</P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>
|
||||
ssize_t mailstream_write(mailstream * s, void * buf, size_t count);
|
||||
|
||||
int mailstream_flush(mailstream * s);
|
||||
|
||||
ssize_t mailstream_read(mailstream * s, void * buf, size_t count);
|
||||
|
||||
ssize_t mailstream_feed_read_buffer(mailstream * s);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_write()</B
|
||||
> writes a buffer to the
|
||||
given stream. This write operation will be buffered.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_flush()</B
|
||||
> will force a write of
|
||||
all buffered data for a given stream.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_read()</B
|
||||
> reads data from the
|
||||
stream to the given buffer.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_feed_read_buffer()</B
|
||||
> this function
|
||||
will just fill the buffer for reading.
|
||||
</P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>
|
||||
mailstream_low * mailstream_get_low(mailstream * s);
|
||||
|
||||
void mailstream_set_low(mailstream * s, mailstream_low * low);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_get_low()</B
|
||||
> returns the low-level
|
||||
stream of the given stream.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_set_low()</B
|
||||
> changes the low-level
|
||||
of the given stream. Useful, for
|
||||
example, when a stream change from clear stream to SSL
|
||||
stream.
|
||||
</P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>char * mailstream_read_line(mailstream * stream, MMAPString * line);
|
||||
|
||||
char * mailstream_read_line_append(mailstream * stream, MMAPString * line);
|
||||
|
||||
char * mailstream_read_line_remove_eol(mailstream * stream, MMAPString * line);
|
||||
|
||||
char * mailstream_read_multiline(mailstream * s, size_t size,
|
||||
MMAPString * stream_buffer,
|
||||
MMAPString * multiline_buffer,
|
||||
size_t progr_rate,
|
||||
progress_function * progr_fun);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_read_line()</B
|
||||
> reads an entire line
|
||||
from the buffer and store it into the
|
||||
given string. returns <B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> on error, the
|
||||
corresponding array
|
||||
of <B
|
||||
CLASS="COMMAND"
|
||||
>char</B
|
||||
> is returned otherwise.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_read_line_append()</B
|
||||
> reads an entire
|
||||
line from the buffer and appends it to the
|
||||
given string. returns <B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> on error, the
|
||||
array of char corresponding to the entire buffer is returned
|
||||
otherwise.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_read_line_remove_eol()</B
|
||||
> reads an
|
||||
entire line from the buffer and store it into the
|
||||
given string. All CR LF are removed.
|
||||
returns <B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> on error, the corresponding
|
||||
array of <B
|
||||
CLASS="COMMAND"
|
||||
>char</B
|
||||
> is returned otherwise.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_read_multiline()</B
|
||||
> reads a
|
||||
multiline data (several lines, the data are ended with
|
||||
a single period '.')
|
||||
from the given stream and store it into the given
|
||||
multiline buffer (multiline_buffer). progr_rate should be 0
|
||||
and progr_fun <B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> (deprecated things).
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>stream_buffer</B
|
||||
> is a buffer used for internal
|
||||
work of the function.
|
||||
size should be 0 (deprecated things).
|
||||
</P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>
|
||||
int mailstream_is_end_multiline(char * line);
|
||||
</PRE
|
||||
><P
|
||||
> returns 1 if the line is an end of multiline data (a single
|
||||
period '.', eventually with CR and/or LF). 0 is returned
|
||||
otherwise.
|
||||
</P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>
|
||||
int mailstream_send_data(mailstream * s, char * message,
|
||||
size_t size,
|
||||
size_t progr_rate,
|
||||
progress_function * progr_fun);
|
||||
</PRE
|
||||
><P
|
||||
> sends multiline data to the given stream.
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>size</B
|
||||
> is the size of the data.
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>progr_rate</B
|
||||
> and <B
|
||||
CLASS="COMMAND"
|
||||
>progr_fun</B
|
||||
>
|
||||
are deprecated. <B
|
||||
CLASS="COMMAND"
|
||||
>progr_rate</B
|
||||
> must be 0,
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>progr_fun</B
|
||||
> must be NULL.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILSTREAM-SOCKET"
|
||||
>socket stream</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>mailstream * mailstream_socket_open(int fd);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_socket_open()</B
|
||||
> will open a
|
||||
clear-text socket.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILSTREAM-SSL"
|
||||
>TLS stream</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>mailstream * mailstream_ssl_open(int fd);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_ssl_open()</B
|
||||
> will open a
|
||||
TLS/SSL socket.
|
||||
</P
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x161.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.htm"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x289.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Hash table</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="c16.htm"
|
||||
ACCESSKEY="U"
|
||||
>Up</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>non-buffered I/O</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
529
libs/libetpan/doc/API/x2583.htm
Normal file
529
libs/libetpan/doc/API/x2583.htm
Normal file
@@ -0,0 +1,529 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Rendering of MIME parts</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="libEtPan! API"
|
||||
HREF="book1.htm"><LINK
|
||||
REL="UP"
|
||||
TITLE="MIME"
|
||||
HREF="c1586.htm"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Parser functions"
|
||||
HREF="x2180.htm"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Creation functions"
|
||||
HREF="x2669.htm"></HEAD
|
||||
><BODY
|
||||
CLASS="SECT1"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>libEtPan! API</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x2180.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
>Chapter 4. MIME</TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x2669.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="AEN2583"
|
||||
>Rendering of MIME parts</A
|
||||
></H1
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILMIME-FIELDS-WRITE"
|
||||
>mailmime_fields_write, mailmime_content_write and
|
||||
mailmime_content_type_write</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
int mailmime_fields_write(FILE * f, int * col,
|
||||
struct mailmime_fields * fields);
|
||||
|
||||
int mailmime_content_write(FILE * f, int * col,
|
||||
struct mailmime_content * content);
|
||||
|
||||
int mailmime_content_type_write(FILE * f, int * col,
|
||||
struct mailmime_content * content);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailmime_fields_write</B
|
||||
> render the MIME
|
||||
header fields.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailmime_content_write</B
|
||||
> render the MIME
|
||||
content type header field.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailmime_content_write</B
|
||||
> render the
|
||||
content of the MIME content type header field.
|
||||
</P
|
||||
><P
|
||||
></P
|
||||
><UL
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>col</B
|
||||
> current column is given for wrapping
|
||||
purpose in <B
|
||||
CLASS="COMMAND"
|
||||
>(* col)</B
|
||||
>,
|
||||
the resulting columns will be returned..
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>f</B
|
||||
> is the file descriptor. It can be
|
||||
stdout for example.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>fields</B
|
||||
> is the header fields
|
||||
(see <A
|
||||
HREF="x1614.htm#MAILMIME-FIELDS"
|
||||
>the Section called <I
|
||||
>mailmime_fields - header fields</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>content</B
|
||||
> is the header fields
|
||||
(see <A
|
||||
HREF="x1614.htm#MAILMIME-CONTENT"
|
||||
>the Section called <I
|
||||
>mailmime_content - MIME content type (Content-Type)</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
></UL
|
||||
><DIV
|
||||
CLASS="EXAMPLE"
|
||||
><A
|
||||
NAME="AEN2610"
|
||||
></A
|
||||
><P
|
||||
><B
|
||||
>Example 4-33. rendering MIME header fields</B
|
||||
></P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
struct mailmime_mime * mime_fields;
|
||||
int col;
|
||||
|
||||
/* look at the example in mailmime_fields to see how to
|
||||
build a mailmime_fields */
|
||||
mime_fields = build_mime_fields();
|
||||
|
||||
col = 0;
|
||||
mailmime_fields_write(stdout, &col, mime_fields);
|
||||
|
||||
mailmime_fields_free(mime_fields);
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
struct mailmime_content * content;
|
||||
int col;
|
||||
|
||||
/* look at the example in mailmime_content to see how to
|
||||
build a mailmime_fields */
|
||||
content = build_mime_content();
|
||||
|
||||
col = 0;
|
||||
mailmime_content_write(stdout, &col, mime_fields);
|
||||
|
||||
mailmime_content_free(content);
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
struct mailmime_content * content;
|
||||
int col;
|
||||
|
||||
/* look at the example in mailmime_content to see how to
|
||||
build a mailmime_fields */
|
||||
content = build_mime_content();
|
||||
|
||||
col = 0;
|
||||
mailmime_content_type_write(stdout, &col, mime_fields);
|
||||
|
||||
mailmime_content_free(content);
|
||||
}
|
||||
</PRE
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILMIME-WRITE"
|
||||
>mailmime_write</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
int mailmime_write(FILE * f, int * col,
|
||||
struct mailmime * build_info);
|
||||
</PRE
|
||||
><P
|
||||
> This function will render a MIME message.
|
||||
</P
|
||||
><P
|
||||
></P
|
||||
><UL
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>col</B
|
||||
> current column is given for wrapping
|
||||
purpose in <B
|
||||
CLASS="COMMAND"
|
||||
>(* col)</B
|
||||
>,
|
||||
the resulting columns will be returned..
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>f</B
|
||||
> is the file descriptor. It can be
|
||||
stdout for example.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>build_info</B
|
||||
> is the MIME message to
|
||||
render.
|
||||
</P
|
||||
></LI
|
||||
></UL
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILMIME-QUOTED-PRINTABLE-WRITE"
|
||||
>mailmime_quoted_printable_write
|
||||
and mailmime_base64_write</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
int mailmime_quoted_printable_write(FILE * f, int * col, int istext,
|
||||
const char * text, size_t size);
|
||||
|
||||
int mailmime_base64_write(FILE * f, int * col,
|
||||
const char * text, size_t size);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailmime_quoted_printable_write()</B
|
||||
> will
|
||||
render a string to quoted printable.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailmime_base64_write()</B
|
||||
> will
|
||||
render a string to base64.
|
||||
</P
|
||||
><P
|
||||
></P
|
||||
><UL
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>col</B
|
||||
> current column is given for wrapping
|
||||
purpose in <B
|
||||
CLASS="COMMAND"
|
||||
>(* col)</B
|
||||
>,
|
||||
the resulting columns will be returned..
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>f</B
|
||||
> is the file descriptor. It can be
|
||||
stdout for example.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>text</B
|
||||
> is the string to render.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>size</B
|
||||
> is the size of the string to
|
||||
render.
|
||||
</P
|
||||
></LI
|
||||
></UL
|
||||
><DIV
|
||||
CLASS="EXAMPLE"
|
||||
><A
|
||||
NAME="AEN2649"
|
||||
></A
|
||||
><P
|
||||
><B
|
||||
>Example 4-34. render base64 or quoted printable</B
|
||||
></P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
int col;
|
||||
|
||||
col = 0;
|
||||
mailmime_quoted_printable_write(stdout, &col,
|
||||
"this is a test", 14);
|
||||
}
|
||||
|
||||
#include <libetpan/libetpan.h>
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
int col;
|
||||
|
||||
col = 0;
|
||||
mailmime_base64_write(stdout, &col, "this is a test", 14);
|
||||
}
|
||||
</PRE
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILMIME-DATA-WRITE"
|
||||
>mailmime_data_write</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
int mailmime_data_write(FILE * f, int * col,
|
||||
struct mailmime_data * data,
|
||||
int istext);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailmime_data_write</B
|
||||
> will
|
||||
render MIME data.
|
||||
</P
|
||||
><P
|
||||
></P
|
||||
><UL
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>col</B
|
||||
> current column is given for wrapping
|
||||
purpose in <B
|
||||
CLASS="COMMAND"
|
||||
>(* col)</B
|
||||
>,
|
||||
the resulting columns will be returned..
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>f</B
|
||||
> is the file descriptor. It can be
|
||||
stdout for example.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>data</B
|
||||
> is the data to render
|
||||
(see <A
|
||||
HREF="x1614.htm#MAILMIME-DATA"
|
||||
>the Section called <I
|
||||
>mailmime_data - Content of MIME part</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
></UL
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x2180.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.htm"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x2669.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Parser functions</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="c1586.htm"
|
||||
ACCESSKEY="U"
|
||||
>Up</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Creation functions</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
1656
libs/libetpan/doc/API/x2669.htm
Normal file
1656
libs/libetpan/doc/API/x2669.htm
Normal file
File diff suppressed because it is too large
Load Diff
245
libs/libetpan/doc/API/x289.htm
Normal file
245
libs/libetpan/doc/API/x289.htm
Normal file
@@ -0,0 +1,245 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>non-buffered I/O</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="libEtPan! API"
|
||||
HREF="book1.htm"><LINK
|
||||
REL="UP"
|
||||
TITLE="Tools and datatypes"
|
||||
HREF="c16.htm"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Buffered I/O"
|
||||
HREF="x229.htm"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="strings"
|
||||
HREF="x312.htm"></HEAD
|
||||
><BODY
|
||||
CLASS="SECT1"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>libEtPan! API</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x229.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
>Chapter 2. Tools and datatypes</TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x312.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="MAILSTREAM-LOW"
|
||||
>non-buffered I/O</A
|
||||
></H1
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>
|
||||
#include <libetpan/libetpan.h>
|
||||
|
||||
struct mailstream_low_driver {
|
||||
ssize_t (* mailstream_read)(mailstream_low *, void *, size_t);
|
||||
ssize_t (* mailstream_write)(mailstream_low *, void *, size_t);
|
||||
int (* mailstream_close)(mailstream_low *);
|
||||
int (* mailstream_get_fd)(mailstream_low *);
|
||||
void (* mailstream_free)(mailstream_low *);
|
||||
};
|
||||
|
||||
typedef struct mailstream_low_driver mailstream_low_driver;
|
||||
|
||||
struct _mailstream_low {
|
||||
void * data;
|
||||
mailstream_low_driver * driver;
|
||||
};
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_low</B
|
||||
> is a non-buffered stream.
|
||||
</P
|
||||
><P
|
||||
> The <B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_low_driver</B
|
||||
> is a set of
|
||||
functions used to access the stream.
|
||||
</P
|
||||
><P
|
||||
></P
|
||||
><UL
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_read/write/close()</B
|
||||
> is the same
|
||||
interface as <B
|
||||
CLASS="COMMAND"
|
||||
>read/write/close()</B
|
||||
>
|
||||
system calls, except that the file descriptor is replaced with the
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_low</B
|
||||
> structure.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_get_fd()</B
|
||||
> returns the file
|
||||
descriptor used for this non-buffered stream.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstream_free()</B
|
||||
> is in charge to free
|
||||
the internal structure of the mailstream_low and the
|
||||
mailstream_low itself.
|
||||
</P
|
||||
></LI
|
||||
></UL
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>
|
||||
mailstream_low * mailstream_low_new(void * data,
|
||||
mailstream_low_driver * driver);
|
||||
</PRE
|
||||
><P
|
||||
> mailstream_low_new() creates a low-level mailstream with the
|
||||
given internal structure (data) and using the given set of
|
||||
functions (driver).
|
||||
</P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>
|
||||
ssize_t mailstream_low_write(mailstream_low * s, void * buf, size_t count);
|
||||
|
||||
ssize_t mailstream_low_read(mailstream_low * s, void * buf, size_t count);
|
||||
|
||||
int mailstream_low_close(mailstream_low * s);
|
||||
|
||||
int mailstream_low_get_fd(mailstream_low * s);
|
||||
|
||||
void mailstream_low_free(mailstream_low * s);
|
||||
</PRE
|
||||
><P
|
||||
> Each of these calls will call the corresponding function defined
|
||||
in the driver.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x229.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.htm"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x312.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Buffered I/O</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="c16.htm"
|
||||
ACCESSKEY="U"
|
||||
>Up</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>strings</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
431
libs/libetpan/doc/API/x2946.htm
Normal file
431
libs/libetpan/doc/API/x2946.htm
Normal file
@@ -0,0 +1,431 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Helper functions</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="libEtPan! API"
|
||||
HREF="book1.htm"><LINK
|
||||
REL="UP"
|
||||
TITLE="MIME"
|
||||
HREF="c1586.htm"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Creation functions"
|
||||
HREF="x2669.htm"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Storages, folders, messages"
|
||||
HREF="c2988.htm"></HEAD
|
||||
><BODY
|
||||
CLASS="SECT1"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>libEtPan! API</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x2669.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
>Chapter 4. MIME</TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="c2988.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="AEN2946"
|
||||
>Helper functions</A
|
||||
></H1
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILMIME-TRANSFER-ENCODING-GET"
|
||||
>mailmime_transfer_encoding_get</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
int mailmime_transfer_encoding_get(struct mailmime_fields * fields);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailmime_transfer_encoding_get()</B
|
||||
> will
|
||||
return the standard MIME encoding mechanism.
|
||||
</P
|
||||
><P
|
||||
></P
|
||||
><UL
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>fields</B
|
||||
> is the list of MIME header
|
||||
fields.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> An integer representing the MIME encoding mechanism will
|
||||
be returned
|
||||
(see <A
|
||||
HREF="x1614.htm#MAILMIME-MECHANISM"
|
||||
>the Section called <I
|
||||
>mailmime_mechanism - MIME transfer encoding mechanism (Content-Transfer-Encoding)</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
></UL
|
||||
><DIV
|
||||
CLASS="EXAMPLE"
|
||||
><A
|
||||
NAME="AEN2960"
|
||||
></A
|
||||
><P
|
||||
><B
|
||||
>Example 4-46. extracting MIME encoding mechanism</B
|
||||
></P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
int fd;
|
||||
int r;
|
||||
|
||||
status = EXIT_FAILURE;
|
||||
|
||||
fd = open("message.rfc2822", O_RDONLY);
|
||||
if (fd >= 0) {
|
||||
void * mem;
|
||||
struct stat stat_info;
|
||||
|
||||
r = fstat(fd, &stat_info);
|
||||
if (r >= 0) {
|
||||
mem = mmap(NULL, stat_info.st_size, PROT_READ, MAP_PRIVATE);
|
||||
if (mem != MAP_FAILED) {
|
||||
struct mailimf_fields * f;
|
||||
size_t current_index;
|
||||
|
||||
current_index = 0;
|
||||
r = mailimf_fields_parse(mem, stat_info.st_size,
|
||||
&current_index, &f);
|
||||
if (r == MAILIMF_NO_ERROR) {
|
||||
struct mailmime_fields * mime_fields;
|
||||
|
||||
r = mailmime_fields_parse(f, &mime_fields);
|
||||
if (r == MAILIMF_NO_ERROR) {
|
||||
int encoding;
|
||||
|
||||
encoding = mailmime_transfer_encoding_get(mime_fields);
|
||||
|
||||
/* do the things */
|
||||
|
||||
mailmime_fields_free(mime_fields);
|
||||
status = EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
mailimf_fields_free(f);
|
||||
}
|
||||
}
|
||||
munmap(mem, stat_info.st_size);
|
||||
}
|
||||
|
||||
close(fd);
|
||||
}
|
||||
|
||||
exit(status);
|
||||
}
|
||||
</PRE
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILMIME-CONTENT-CHARSET-GET"
|
||||
>mailmime_content_charset_get and
|
||||
mailmime_content_param_get</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
char * mailmime_content_charset_get(struct mailmime_content * content);
|
||||
|
||||
char * mailmime_content_param_get(struct mailmime_content * content,
|
||||
char * name);
|
||||
|
||||
char * mailmime_extract_boundary(struct mailmime_content * content_type);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailmime_content_charset_get()</B
|
||||
> will
|
||||
return the <B
|
||||
CLASS="COMMAND"
|
||||
>charset</B
|
||||
> parameter of
|
||||
MIME content type.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailmime_content_param_get()</B
|
||||
> will
|
||||
return the value of a given parameter of
|
||||
MIME content type.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailmime_extract_boundary()</B
|
||||
> will
|
||||
return the <B
|
||||
CLASS="COMMAND"
|
||||
>charset</B
|
||||
> parameter of
|
||||
MIME content type.
|
||||
</P
|
||||
><P
|
||||
></P
|
||||
><UL
|
||||
><LI
|
||||
><P
|
||||
>
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>content</B
|
||||
> is the MIME content type.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>name</B
|
||||
> is the name of the parameter to
|
||||
extract.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> With <B
|
||||
CLASS="COMMAND"
|
||||
>mailmime_extract_boundary()</B
|
||||
>, the
|
||||
returned value must be freed with
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>free()</B
|
||||
>.
|
||||
</P
|
||||
></LI
|
||||
></UL
|
||||
><DIV
|
||||
CLASS="EXAMPLE"
|
||||
><A
|
||||
NAME="AEN2985"
|
||||
></A
|
||||
><P
|
||||
><B
|
||||
>Example 4-47. extracting information from MIME content type</B
|
||||
></P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
int fd;
|
||||
int r;
|
||||
|
||||
status = EXIT_FAILURE;
|
||||
|
||||
fd = open("message.rfc2822", O_RDONLY);
|
||||
if (fd >= 0) {
|
||||
void * mem;
|
||||
struct stat stat_info;
|
||||
|
||||
r = fstat(fd, &stat_info);
|
||||
if (r >= 0) {
|
||||
mem = mmap(NULL, stat_info.st_size, PROT_READ, MAP_PRIVATE);
|
||||
if (mem != MAP_FAILED) {
|
||||
struct mailimf_fields * f;
|
||||
size_t current_index;
|
||||
|
||||
current_index = 0;
|
||||
r = mailimf_fields_parse(mem, stat_info.st_size,
|
||||
&current_index, &f);
|
||||
if (r == MAILIMF_NO_ERROR) {
|
||||
clistiter * cur;
|
||||
|
||||
for(cur = clist_begin(f->fld_list) ; cur != NULL ; cur =
|
||||
clist_next(cur)) {
|
||||
struct mailmime_field * mime_field;
|
||||
struct mailimf_field * field;
|
||||
|
||||
field = clist_content(cur);
|
||||
|
||||
if (field->fld_type == MAILIMF_FIELD_OPTIONAL_FIELD) {
|
||||
if (strcasecmp(field->fld_data.fld_optional_field->fld_name,
|
||||
"Content-Type") == 0) {
|
||||
struct mailmime_content * content_type;
|
||||
size_t current_index;
|
||||
|
||||
current_index = 0;
|
||||
r = mailmime_content_parse(field->fld_data.fld_optional_field->fld_value,
|
||||
strlen(field->fld_data.fld_optional_field->fld_value),
|
||||
&current_index, &content_type);
|
||||
if (r == MAILIMF_NO_ERROR) {
|
||||
char * charset;
|
||||
char * name;
|
||||
char * boundary;
|
||||
|
||||
charset = mailmime_content_charset_get(content_type);
|
||||
name = mailmime_content_param_get(content_type, "name");
|
||||
boundary = mailmime_extract_boundary(content_type);
|
||||
|
||||
/* do the things */
|
||||
|
||||
free(boundary);
|
||||
|
||||
status = EXIT_SUCCESS;
|
||||
mailmime_content_free(content_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mailimf_fields_free(f);
|
||||
}
|
||||
}
|
||||
munmap(mem, stat_info.st_size);
|
||||
}
|
||||
|
||||
close(fd);
|
||||
}
|
||||
|
||||
exit(status);
|
||||
}
|
||||
</PRE
|
||||
></DIV
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x2669.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.htm"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="c2988.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Creation functions</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="c1586.htm"
|
||||
ACCESSKEY="U"
|
||||
>Up</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Storages, folders, messages</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
208
libs/libetpan/doc/API/x3011.htm
Normal file
208
libs/libetpan/doc/API/x3011.htm
Normal file
@@ -0,0 +1,208 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Error codes</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="libEtPan! API"
|
||||
HREF="book1.htm"><LINK
|
||||
REL="UP"
|
||||
TITLE="Storages, folders, messages"
|
||||
HREF="c2988.htm"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Storages, folders, messages"
|
||||
HREF="c2988.htm"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Storage"
|
||||
HREF="x3015.htm"></HEAD
|
||||
><BODY
|
||||
CLASS="SECT1"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>libEtPan! API</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="c2988.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
>Chapter 5. Storages, folders, messages</TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x3015.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="AEN3011"
|
||||
>Error codes</A
|
||||
></H1
|
||||
><P
|
||||
> Error codes returned as integers can be one of the following :
|
||||
</P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>enum {
|
||||
MAIL_NO_ERROR = 0,
|
||||
MAIL_NO_ERROR_AUTHENTICATED,
|
||||
MAIL_NO_ERROR_NON_AUTHENTICATED,
|
||||
MAIL_ERROR_NOT_IMPLEMENTED,
|
||||
MAIL_ERROR_UNKNOWN,
|
||||
MAIL_ERROR_CONNECT,
|
||||
MAIL_ERROR_BAD_STATE,
|
||||
MAIL_ERROR_FILE,
|
||||
MAIL_ERROR_STREAM,
|
||||
MAIL_ERROR_LOGIN,
|
||||
MAIL_ERROR_CREATE, /* 10 */
|
||||
MAIL_ERROR_DELETE,
|
||||
MAIL_ERROR_LOGOUT,
|
||||
MAIL_ERROR_NOOP,
|
||||
MAIL_ERROR_RENAME,
|
||||
MAIL_ERROR_CHECK,
|
||||
MAIL_ERROR_EXAMINE,
|
||||
MAIL_ERROR_SELECT,
|
||||
MAIL_ERROR_MEMORY,
|
||||
MAIL_ERROR_STATUS,
|
||||
MAIL_ERROR_SUBSCRIBE, /* 20 */
|
||||
MAIL_ERROR_UNSUBSCRIBE,
|
||||
MAIL_ERROR_LIST,
|
||||
MAIL_ERROR_LSUB,
|
||||
MAIL_ERROR_APPEND,
|
||||
MAIL_ERROR_COPY,
|
||||
MAIL_ERROR_FETCH,
|
||||
MAIL_ERROR_STORE,
|
||||
MAIL_ERROR_SEARCH,
|
||||
MAIL_ERROR_DISKSPACE,
|
||||
MAIL_ERROR_MSG_NOT_FOUND, /* 30 */
|
||||
MAIL_ERROR_PARSE,
|
||||
MAIL_ERROR_INVAL,
|
||||
MAIL_ERROR_PART_NOT_FOUND,
|
||||
MAIL_ERROR_REMOVE,
|
||||
MAIL_ERROR_FOLDER_NOT_FOUND,
|
||||
MAIL_ERROR_MOVE,
|
||||
MAIL_ERROR_STARTTLS,
|
||||
MAIL_ERROR_CACHE_MISS,
|
||||
MAIL_ERROR_NO_TLS,
|
||||
MAIL_ERROR_EXPUNGE,
|
||||
/* misc errors */
|
||||
MAIL_ERROR_MISC,
|
||||
MAIL_ERROR_PROTOCOL,
|
||||
MAIL_ERROR_CAPABILITY,
|
||||
MAIL_ERROR_CLOSE,
|
||||
MAIL_ERROR_FATAL,
|
||||
MAIL_ERROR_READONLY,
|
||||
MAIL_ERROR_NO_APOP,
|
||||
MAIL_ERROR_COMMAND_NOT_SUPPORTED,
|
||||
MAIL_ERROR_NO_PERMISSION,
|
||||
MAIL_ERROR_PROGRAM_ERROR,
|
||||
MAIL_ERROR_SUBJECT_NOT_FOUND,
|
||||
MAIL_ERROR_CHAR_ENCODING_FAILED,
|
||||
MAIL_ERROR_SEND,
|
||||
MAIL_ERROR_COMMAND,
|
||||
};
|
||||
</PRE
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="c2988.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.htm"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x3015.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Storages, folders, messages</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="c2988.htm"
|
||||
ACCESSKEY="U"
|
||||
>Up</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Storage</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
433
libs/libetpan/doc/API/x3015.htm
Normal file
433
libs/libetpan/doc/API/x3015.htm
Normal file
@@ -0,0 +1,433 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Storage</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="libEtPan! API"
|
||||
HREF="book1.htm"><LINK
|
||||
REL="UP"
|
||||
TITLE="Storages, folders, messages"
|
||||
HREF="c2988.htm"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Error codes"
|
||||
HREF="x3011.htm"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Folder"
|
||||
HREF="x3082.htm"></HEAD
|
||||
><BODY
|
||||
CLASS="SECT1"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>libEtPan! API</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x3011.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
>Chapter 5. Storages, folders, messages</TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x3082.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="AEN3015"
|
||||
>Storage</A
|
||||
></H1
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILSTORAGE-DRIVER"
|
||||
>Storage driver</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
typedef struct mailstorage_driver mailstorage_driver;
|
||||
|
||||
struct mailstorage_driver {
|
||||
char * sto_name;
|
||||
int (* sto_connect)(struct mailstorage * storage);
|
||||
int (* sto_get_folder_session)(struct mailstorage * storage,
|
||||
char * pathname, mailsession ** result);
|
||||
void (* sto_uninitialize)(struct mailstorage * storage);
|
||||
};
|
||||
</PRE
|
||||
><P
|
||||
> This is the driver for a storage.
|
||||
</P
|
||||
><P
|
||||
></P
|
||||
><UL
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>sto_name</B
|
||||
> is the name of the driver.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>sto_connect()</B
|
||||
> connects the storage to
|
||||
the remote access or to the path in the local filesystem.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>sto_get_folder_session()</B
|
||||
> can have two
|
||||
kinds of behaviour. Either it creates a new session and
|
||||
independant from the session used by the storage and
|
||||
select the given mailbox or it selects the given mailbox
|
||||
in the current session. It depends on the efficiency of
|
||||
the mail access.
|
||||
</P
|
||||
><P
|
||||
> <SPAN
|
||||
CLASS="emphasis"
|
||||
><I
|
||||
CLASS="EMPHASIS"
|
||||
>XXX - in the future, this will be moved to the
|
||||
folder driver</I
|
||||
></SPAN
|
||||
>
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>sto_uninitialize()</B
|
||||
> frees the data
|
||||
created with mailstorage constructor.
|
||||
</P
|
||||
></LI
|
||||
></UL
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILSTORAGE"
|
||||
>Storage</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
struct mailstorage {
|
||||
char * sto_id;
|
||||
void * sto_data;
|
||||
mailsession * sto_session;
|
||||
mailstorage_driver * sto_driver;
|
||||
clist * sto_shared_folders; /* list of (struct mailfolder *) */
|
||||
|
||||
void * sto_user_data;
|
||||
};
|
||||
</PRE
|
||||
><P
|
||||
></P
|
||||
><UL
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>sto_id</B
|
||||
> is an identifier for the
|
||||
storage. This can be <B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
>.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>sto_data</B
|
||||
> is the internal data
|
||||
of the storage. This can only be changed by the driver.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>sto_session</B
|
||||
> is the session used by
|
||||
the storage. The session can be used to send commands.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>sto_driver</B
|
||||
> is the driver of the
|
||||
storage.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>sto_shared_folders</B
|
||||
> is the list of
|
||||
folders that share the session with the storage.
|
||||
This is used internally.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>sto_user_data</B
|
||||
> is a field for free
|
||||
use. The user can store any data in that field.
|
||||
</P
|
||||
></LI
|
||||
></UL
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILSTORAGE-NEW"
|
||||
>mailstorage_new and mailstorage_free</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
struct mailstorage * mailstorage_new(char * sto_id);
|
||||
|
||||
void mailstorage_free(struct mailstorage * storage);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstorage_new()</B
|
||||
> initializes a storage
|
||||
structure with an identifier (<B
|
||||
CLASS="COMMAND"
|
||||
>sto_id</B
|
||||
>) and
|
||||
with no driver.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstorage_free()</B
|
||||
> free the memory used
|
||||
by a storage.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILSTORAGE-CONNECT"
|
||||
>mailstorage_connect and mailstorage_disconnect</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
int mailstorage_connect(struct mailstorage * storage);
|
||||
|
||||
void mailstorage_disconnect(struct mailstorage * storage);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstorage_connect()</B
|
||||
> connects the storage.
|
||||
This function can also be used to confirm that a storage
|
||||
connection is valid when the storage is already connected.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailstorage_disconnect()</B
|
||||
> disconnects the
|
||||
storage.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="AEN3074"
|
||||
>IMAP storage</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int imap_mailstorage_init(struct mailstorage * storage,
|
||||
char * imap_servername, uint16_t imap_port,
|
||||
char * imap_command,
|
||||
int imap_connection_type, int imap_auth_type,
|
||||
char * imap_login, char * imap_password,
|
||||
int imap_cached, char * imap_cache_directory);
|
||||
</PRE
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="AEN3077"
|
||||
>Example</A
|
||||
></H2
|
||||
><DIV
|
||||
CLASS="EXAMPLE"
|
||||
><A
|
||||
NAME="AEN3079"
|
||||
></A
|
||||
><P
|
||||
><B
|
||||
>Example 5-1. use of storage</B
|
||||
></P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int main(void)
|
||||
{
|
||||
struct mailstorage * storage;
|
||||
int r;
|
||||
|
||||
storage = mailstorage_new(NULL);
|
||||
|
||||
imap_mailstorage_init(storage, "imap.my-servers.org", 0,
|
||||
NULL, CONNECTION_TYPE_TRY_STARTTLS, IMAP_AUTH_TYPE_PLAIN,
|
||||
"my-login", "my-password", 1, "/home/login/.libetpan/cache");
|
||||
|
||||
r = mailstorage_connect(storage);
|
||||
if (r == MAIL_NO_ERROR) {
|
||||
mailstorage_disconnect(storage);
|
||||
}
|
||||
|
||||
mailstorage_free(storage);
|
||||
}
|
||||
</PRE
|
||||
></DIV
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x3011.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.htm"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x3082.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Error codes</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="c2988.htm"
|
||||
ACCESSKEY="U"
|
||||
>Up</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Folder</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
691
libs/libetpan/doc/API/x3082.htm
Normal file
691
libs/libetpan/doc/API/x3082.htm
Normal file
@@ -0,0 +1,691 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>Folder</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="libEtPan! API"
|
||||
HREF="book1.htm"><LINK
|
||||
REL="UP"
|
||||
TITLE="Storages, folders, messages"
|
||||
HREF="c2988.htm"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Storage"
|
||||
HREF="x3015.htm"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Message"
|
||||
HREF="x3198.htm"></HEAD
|
||||
><BODY
|
||||
CLASS="SECT1"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>libEtPan! API</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x3015.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
>Chapter 5. Storages, folders, messages</TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x3198.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="AEN3082"
|
||||
>Folder</A
|
||||
></H1
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILFOLDER-DRIVER"
|
||||
>Folder driver</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
typedef struct mailfolder_driver mailfolder_driver;
|
||||
|
||||
struct mailfolder_driver {
|
||||
int (* fld_get_session)(struct mailfolder * folder,
|
||||
mailsession ** result);
|
||||
|
||||
int (* fld_noop)(struct mailfolder * folder);
|
||||
|
||||
int (* fld_check)(struct mailfolder * folder);
|
||||
|
||||
int (* fld_expunge)(struct mailfolder * folder);
|
||||
|
||||
int (* fld_status)(struct mailfolder * folder,
|
||||
uint32_t * result_messages, uint32_t * result_recent,
|
||||
uint32_t * result_unseen);
|
||||
|
||||
int (* fld_append_message)(struct mailfolder * folder,
|
||||
char * message, size_t size);
|
||||
|
||||
int (* fld_get_messages_list)(struct mailfolder * folder,
|
||||
struct mailmessage_list ** result);
|
||||
|
||||
int (* fld_get_envelopes_list)(struct mailfolder * folder,
|
||||
struct mailmessage_list * result);
|
||||
|
||||
int (* fld_get_message)(struct mailfolder * folder,
|
||||
uint32_t num, mailmessage ** result);
|
||||
|
||||
int (* fld_get_message_by_uid)(struct mailfolder * folder,
|
||||
const char * uid, mailmessage ** result);
|
||||
}
|
||||
</PRE
|
||||
><P
|
||||
> XXX - this will be implemented in the future.
|
||||
</P
|
||||
><P
|
||||
></P
|
||||
><UL
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>fld_get_session()</B
|
||||
> will return the session
|
||||
this folder should use.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> For other method, you should see <A
|
||||
HREF="x3472.htm#MAILSESSION-DRIVER"
|
||||
>the Section called <I
|
||||
>Session driver</I
|
||||
></A
|
||||
>.
|
||||
</P
|
||||
></LI
|
||||
></UL
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="AEN3095"
|
||||
>Folder</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
struct mailfolder {
|
||||
char * fld_pathname;
|
||||
char * fld_virtual_name;
|
||||
|
||||
struct mailstorage * fld_storage;
|
||||
|
||||
mailsession * fld_session;
|
||||
int fld_shared_session;
|
||||
clistiter * fld_pos;
|
||||
|
||||
struct mailfolder * fld_parent;
|
||||
unsigned int fld_sibling_index;
|
||||
carray * fld_children; /* array of (struct mailfolder *) */
|
||||
|
||||
void * fld_user_data;
|
||||
};
|
||||
</PRE
|
||||
><P
|
||||
></P
|
||||
><UL
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>fld_pathname</B
|
||||
> is the pathname specific to
|
||||
the driver.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>fld_virtual_name</B
|
||||
> is the identifier of
|
||||
this folder. This can be <B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
>.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>fld_storage</B
|
||||
> is the storage used for this
|
||||
folder (see <A
|
||||
HREF="x3015.htm#MAILSTORAGE"
|
||||
>the Section called <I
|
||||
>Storage</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>fld_session</B
|
||||
> is the session used for this
|
||||
folder.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>fld_shared_session</B
|
||||
> is set to 1 if the
|
||||
folder use the same session as the storage. This is used
|
||||
internally.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>fld_pos</B
|
||||
> is the
|
||||
position in the list of folders of the storage.
|
||||
This is used internally.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> use of <B
|
||||
CLASS="COMMAND"
|
||||
>fld_parent</B
|
||||
>,
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>fld_sibling_index</B
|
||||
> and
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>fld_children</B
|
||||
> is deprecated.
|
||||
</P
|
||||
></LI
|
||||
><LI
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>fld_user_data</B
|
||||
> is a field for free
|
||||
use. The user can store any data in that field.
|
||||
</P
|
||||
></LI
|
||||
></UL
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILFOLDER-NEW"
|
||||
>mailfolder_new and mail_folder_free</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
struct mailfolder * mailfolder_new(struct mailstorage * fld_storage,
|
||||
char * fld_pathname, char * fld_virtual_name);
|
||||
|
||||
void mailfolder_free(struct mailfolder * folder);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailfolder_new()</B
|
||||
> initializes a folder
|
||||
structure with an identifier
|
||||
(<B
|
||||
CLASS="COMMAND"
|
||||
>fld_virtual_name</B
|
||||
>) with path name
|
||||
(<B
|
||||
CLASS="COMMAND"
|
||||
>fld_pathname</B
|
||||
>). The folder will be owned
|
||||
by the given storage (<B
|
||||
CLASS="COMMAND"
|
||||
>fld_storage</B
|
||||
>).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailfolder_free()</B
|
||||
> free the memory used
|
||||
by the folder.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILFOLDER-CONNECT"
|
||||
>mailfolder_connect and mailfolder_disconnect</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
int mailfolder_connect(struct mailfolder * folder);
|
||||
|
||||
void mailfolder_disconnect(struct mailfolder * folder);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailfolder_connect()</B
|
||||
> connects the folder.
|
||||
This function can also be used to confirm that a folder
|
||||
connection is valid when the folder is already connected.
|
||||
When doing operations with several folders, you have to be
|
||||
sure that this function has been called before making calls
|
||||
on folder.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mailfolder_disconnect()</B
|
||||
> disconnects the
|
||||
folder.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILFOLDER-NOOP"
|
||||
>mailfolder_noop</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
int mailfolder_noop(struct mailfolder * folder);
|
||||
</PRE
|
||||
><P
|
||||
> This function will only send noop to the mail access.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILFOLDER-CHECK"
|
||||
>mailfolder_check</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
int mailfolder_check(struct mailfolder * folder);
|
||||
</PRE
|
||||
><P
|
||||
> A call to this function will save to disk the internal state
|
||||
of the selected mailbox (such as flags).
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILFOLDER-EXPUNGE"
|
||||
>mailfolder_expunge</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
int mailfolder_expunge(struct mailfolder * folder);
|
||||
</PRE
|
||||
><P
|
||||
> A call to this function will delete all messages marked for
|
||||
deletion.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILFOLDER-STATUS"
|
||||
>mailfolder_status</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int mailfolder_status(struct mailfolder * folder,
|
||||
uint32_t * result_messages, uint32_t * result_recent,
|
||||
uint32_t * result_unseen);
|
||||
</PRE
|
||||
><P
|
||||
> A call to this function will return some counts of messages
|
||||
in the mailbox.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILFOLDER-APPEND-MESSAGE"
|
||||
>mailfolder_append_message</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int mailfolder_append_message(struct mailfolder * folder,
|
||||
char * message, size_t size);
|
||||
</PRE
|
||||
><P
|
||||
> This function will store a new message in the given folder.
|
||||
The message is given by a string in memory
|
||||
(<B
|
||||
CLASS="COMMAND"
|
||||
>message</B
|
||||
>) and a size
|
||||
(<B
|
||||
CLASS="COMMAND"
|
||||
>size</B
|
||||
>).
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILFOLDER-GET-MESSAGES-LIST"
|
||||
>mailfolder_get_messages_list</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int mailfolder_get_messages_list(struct mailfolder * folder,
|
||||
struct mailmessage_list ** result);
|
||||
</PRE
|
||||
><P
|
||||
> This function will return the list of messages in the given
|
||||
folder (see <A
|
||||
HREF="x3198.htm#MAILMESSAGE-LIST"
|
||||
>the Section called <I
|
||||
>Message list</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILFOLDER-GET-ENVELOPES-LIST"
|
||||
>mailfolder_get_envelopes_list</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int mailfolder_get_envelopes_list(struct mailfolder * folder,
|
||||
struct mailmessage_list * result);
|
||||
</PRE
|
||||
><P
|
||||
> This function will fill the list of parsed header fields
|
||||
structure in the <B
|
||||
CLASS="COMMAND"
|
||||
>mailmessage</B
|
||||
> structures
|
||||
of the given list of messages (<B
|
||||
CLASS="COMMAND"
|
||||
>result</B
|
||||
>).
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILFOLDER-GET-MESSAGE"
|
||||
>mailfolder_get_message</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int mailfolder_get_message(struct mailfolder * folder,
|
||||
uint32_t num, mailmessage ** result);
|
||||
</PRE
|
||||
><P
|
||||
> This function will return the message identified by a
|
||||
message index (<B
|
||||
CLASS="COMMAND"
|
||||
>num</B
|
||||
>)
|
||||
This will return a <B
|
||||
CLASS="COMMAND"
|
||||
>mailmessage</B
|
||||
> structure
|
||||
in <B
|
||||
CLASS="COMMAND"
|
||||
>(* result)</B
|
||||
> (see <A
|
||||
HREF="x3198.htm#MAILMESSAGE"
|
||||
>the Section called <I
|
||||
>Message</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MAILFOLDER-GET-MESSAGE-BY-UID"
|
||||
>mailfolder_get_message_by_uid</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int mailfolder_get_message_by_uid(struct mailfolder * folder,
|
||||
const char * uid, mailmessage ** result);
|
||||
</PRE
|
||||
><P
|
||||
> This function will return the message identified by a
|
||||
unique identifier (<B
|
||||
CLASS="COMMAND"
|
||||
>uid</B
|
||||
>)
|
||||
This will return a <B
|
||||
CLASS="COMMAND"
|
||||
>mailmessage</B
|
||||
> structure
|
||||
in <B
|
||||
CLASS="COMMAND"
|
||||
>(* result)</B
|
||||
> (see <A
|
||||
HREF="x3198.htm#MAILMESSAGE"
|
||||
>the Section called <I
|
||||
>Message</I
|
||||
></A
|
||||
>).
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="AEN3193"
|
||||
>Example</A
|
||||
></H2
|
||||
><DIV
|
||||
CLASS="EXAMPLE"
|
||||
><A
|
||||
NAME="AEN3195"
|
||||
></A
|
||||
><P
|
||||
><B
|
||||
>Example 5-2. use of folder</B
|
||||
></P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int main(void)
|
||||
{
|
||||
struct mailstorage * storage;
|
||||
int r;
|
||||
|
||||
storage = mailstorage_new(NULL);
|
||||
|
||||
imap_mailstorage_init(storage, "imap.my-servers.org", 0,
|
||||
NULL, CONNECTION_TYPE_TRY_STARTTLS, IMAP_AUTH_TYPE_PLAIN,
|
||||
"my-login", "my-password", 1, "/home/login/.libetpan/cache");
|
||||
|
||||
r = mailstorage_connect(storage);
|
||||
if (r == MAIL_NO_ERROR) {
|
||||
struct mailfolder * folder;
|
||||
|
||||
folder = mailfolder_new(storage, "INBOX", NULL);
|
||||
|
||||
r = mailfolder_connect(folder);
|
||||
if (r == MAIL_NO_ERROR) {
|
||||
struct mailmessage_list * msg_list;
|
||||
|
||||
mailfolder_get_messages_list(folder, &msg_list);
|
||||
|
||||
/* do the things */
|
||||
|
||||
mailmessage_list_free(msg_list);
|
||||
|
||||
mailfolder_disconnect(folder);
|
||||
}
|
||||
|
||||
mailstorage_disconnect(storage);
|
||||
}
|
||||
|
||||
mailstorage_free(storage);
|
||||
}
|
||||
</PRE
|
||||
></DIV
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x3015.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.htm"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x3198.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Storage</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="c2988.htm"
|
||||
ACCESSKEY="U"
|
||||
>Up</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Message</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
477
libs/libetpan/doc/API/x312.htm
Normal file
477
libs/libetpan/doc/API/x312.htm
Normal file
@@ -0,0 +1,477 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>strings</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="libEtPan! API"
|
||||
HREF="book1.htm"><LINK
|
||||
REL="UP"
|
||||
TITLE="Tools and datatypes"
|
||||
HREF="c16.htm"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="non-buffered I/O"
|
||||
HREF="x289.htm"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Internet Message Format"
|
||||
HREF="c385.htm"></HEAD
|
||||
><BODY
|
||||
CLASS="SECT1"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>libEtPan! API</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x289.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
>Chapter 2. Tools and datatypes</TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="c385.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="AEN312"
|
||||
>strings</A
|
||||
></H1
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>
|
||||
#include <libetpan/libetpan.h>
|
||||
|
||||
struct _MMAPString
|
||||
{
|
||||
char * str;
|
||||
size_t len;
|
||||
size_t allocated_len;
|
||||
int fd;
|
||||
size_t mmapped_size;
|
||||
};
|
||||
|
||||
typedef struct _MMAPString MMAPString;
|
||||
</PRE
|
||||
><P
|
||||
> MMAPString is a string which size that can increase automatically.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MMAP-STRING-NEW"
|
||||
>constructor and destructor</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>MMAPString * mmap_string_new(const char * init);
|
||||
|
||||
MMAPString * mmap_string_new_len(const char * init, size_t len);
|
||||
|
||||
MMAPString * mmap_string_sized_new(size_t dfl_size);
|
||||
|
||||
void mmap_string_free(MMAPString * string);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mmap_string_new()</B
|
||||
> allocates a new
|
||||
string. init is the intial value of the string.
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> will be returned on error.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mmap_string_new_len()</B
|
||||
> allocates a new
|
||||
string. init is the intial value of the
|
||||
string, len is the length of the initial string.
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> will be returned on error.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mmap_string_sized_new()</B
|
||||
> allocates a new
|
||||
string. dfl_size is the initial allocation of
|
||||
the string. <B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> will be returned on error.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mmap_string_free()</B
|
||||
> release the memory used
|
||||
by the string.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MMAP-STRING-ASSIGN"
|
||||
>string value modification</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>MMAPString * mmap_string_assign(MMAPString * string, const char * rval);
|
||||
|
||||
MMAPString * mmap_string_truncate(MMAPString *string, size_t len);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mmap_string_assign()</B
|
||||
> sets a new value for
|
||||
the given string.
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> will be returned on error.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mmap_string_truncate()</B
|
||||
> sets a length for
|
||||
the string.
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> will be returned on error.
|
||||
</P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>MMAPString * mmap_string_set_size (MMAPString * string, size_t len);
|
||||
</PRE
|
||||
><P
|
||||
> sets the allocation of the string.
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> will be returned on error.
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MMAP-STRING-APPEND"
|
||||
>insertion in string, deletion in string</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>MMAPString * mmap_string_insert_len(MMAPString * string, size_t pos,
|
||||
const char * val, size_t len);
|
||||
|
||||
MMAPString * mmap_string_append(MMAPString * string, const char * val);
|
||||
|
||||
MMAPString * mmap_string_append_len(MMAPString * string,
|
||||
const char * val, size_t len);
|
||||
|
||||
MMAPString * mmap_string_append_c(MMAPString * string, char c);
|
||||
|
||||
MMAPString * mmap_string_prepend(MMAPString * string, const char * val);
|
||||
|
||||
MMAPString * mmap_string_prepend_c(MMAPString * string, char c);
|
||||
|
||||
MMAPString * mmap_string_prepend_len(MMAPString * string, const char * val,
|
||||
size_t len);
|
||||
|
||||
MMAPString * mmap_string_insert(MMAPString * string, size_t pos,
|
||||
const char * val);
|
||||
|
||||
MMAPString * mmap_string_insert_c(MMAPString *string, size_t pos,
|
||||
char c);
|
||||
|
||||
MMAPString * mmap_string_erase(MMAPString * string, size_t pos,
|
||||
size_t len);
|
||||
</PRE
|
||||
><P
|
||||
> For complexity here, n is the size of the given MMAPString,
|
||||
and len is the size of the string to insert.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mmap_string_insert_len()</B
|
||||
> inserts the given
|
||||
string value of given length in the string at the given
|
||||
position. <B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> will be returned on error.
|
||||
Complexity is O(n + len).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mmap_string_append()</B
|
||||
> appends the given
|
||||
string value at the end of the string.
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> will be returned on error.
|
||||
Complexity is O(len).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mmap_string_append_len()</B
|
||||
> appends the
|
||||
given string value of given length at the end of the
|
||||
string. <B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> will be returned on error.
|
||||
Complexity is O(len).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mmap_string_append_c()</B
|
||||
> appends the given
|
||||
character at the end of the string.
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> will be returned on error.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mmap_string_prepend()</B
|
||||
> insert the given
|
||||
string value at the beginning of the string.
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> will be returned on error.
|
||||
Complexity is O(n + len).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mmap_string_prepend_c()</B
|
||||
> insert the given
|
||||
character at the beginning of the string.
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> will be returned on error.
|
||||
Complexity is O(n).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mmap_string_prepend_len()</B
|
||||
> insert the given
|
||||
string value of given length at the beginning of the string.
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> will be returned on error.
|
||||
Complexity is O(n + len).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mmap_string_insert()</B
|
||||
> inserts the given
|
||||
string value in the string at the given position.
|
||||
NULL will be returned on error.
|
||||
Complexity is O(n + len).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mmap_string_insert_c()</B
|
||||
> inserts the given
|
||||
character in the string at the given position.
|
||||
NULL will be returned on error.
|
||||
Complexity is O(n).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mmap_string_erase()</B
|
||||
> removes the given
|
||||
count of characters (len) at the given position of the
|
||||
string. <B
|
||||
CLASS="COMMAND"
|
||||
>NULL</B
|
||||
> will be returned on error.
|
||||
Complexity is O(n).
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="MMAP-STRING-REF"
|
||||
>referencing string</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int mmap_string_ref(MMAPString * string);
|
||||
|
||||
int mmap_string_unref(char * str);
|
||||
</PRE
|
||||
><P
|
||||
> MMAPString provides a mechanism that let you use MMAPString
|
||||
like normal strings. You have first to use
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>mmap_string_ref()</B
|
||||
>, so that you notify
|
||||
that the string will be used as a normal string, then, you
|
||||
use <B
|
||||
CLASS="COMMAND"
|
||||
>mmapstr->str</B
|
||||
> to refer to the
|
||||
string. When you have finished and you want to free a string
|
||||
corresponding to a <B
|
||||
CLASS="COMMAND"
|
||||
>MMAPString</B
|
||||
>, you will
|
||||
use <B
|
||||
CLASS="COMMAND"
|
||||
>mmap_string_unref</B
|
||||
>.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>mmap_string_ref()</B
|
||||
> references the string
|
||||
so that the array of characters can be used as a normal
|
||||
string then released with
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>mmap_string_unref()</B
|
||||
>.
|
||||
The array of characters will be obtained with string->str.
|
||||
returns -1 on error, 0 on success.
|
||||
</P
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x289.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.htm"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="c385.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>non-buffered I/O</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="c16.htm"
|
||||
ACCESSKEY="U"
|
||||
>Up</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Internet Message Format</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
1785
libs/libetpan/doc/API/x3198.htm
Normal file
1785
libs/libetpan/doc/API/x3198.htm
Normal file
File diff suppressed because it is too large
Load Diff
1361
libs/libetpan/doc/API/x3472.htm
Normal file
1361
libs/libetpan/doc/API/x3472.htm
Normal file
File diff suppressed because it is too large
Load Diff
4306
libs/libetpan/doc/API/x425.htm
Normal file
4306
libs/libetpan/doc/API/x425.htm
Normal file
File diff suppressed because it is too large
Load Diff
600
libs/libetpan/doc/API/x88.htm
Normal file
600
libs/libetpan/doc/API/x88.htm
Normal file
@@ -0,0 +1,600 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
||||
<HTML
|
||||
><HEAD
|
||||
><TITLE
|
||||
>List</TITLE
|
||||
><META
|
||||
NAME="GENERATOR"
|
||||
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
|
||||
REL="HOME"
|
||||
TITLE="libEtPan! API"
|
||||
HREF="book1.htm"><LINK
|
||||
REL="UP"
|
||||
TITLE="Tools and datatypes"
|
||||
HREF="c16.htm"><LINK
|
||||
REL="PREVIOUS"
|
||||
TITLE="Tools and datatypes"
|
||||
HREF="c16.htm"><LINK
|
||||
REL="NEXT"
|
||||
TITLE="Hash table"
|
||||
HREF="x161.htm"></HEAD
|
||||
><BODY
|
||||
CLASS="SECT1"
|
||||
BGCOLOR="#FFFFFF"
|
||||
TEXT="#000000"
|
||||
LINK="#0000FF"
|
||||
VLINK="#840084"
|
||||
ALINK="#0000FF"
|
||||
><DIV
|
||||
CLASS="NAVHEADER"
|
||||
><TABLE
|
||||
SUMMARY="Header navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TH
|
||||
COLSPAN="3"
|
||||
ALIGN="center"
|
||||
>libEtPan! API</TH
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="left"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="c16.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="80%"
|
||||
ALIGN="center"
|
||||
VALIGN="bottom"
|
||||
>Chapter 2. Tools and datatypes</TD
|
||||
><TD
|
||||
WIDTH="10%"
|
||||
ALIGN="right"
|
||||
VALIGN="bottom"
|
||||
><A
|
||||
HREF="x161.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
></TABLE
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"></DIV
|
||||
><DIV
|
||||
CLASS="SECT1"
|
||||
><H1
|
||||
CLASS="SECT1"
|
||||
><A
|
||||
NAME="CLIST"
|
||||
>List</A
|
||||
></H1
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
typedef struct clist_s clist;
|
||||
|
||||
typedef clistcell clistiter;
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>clist()</B
|
||||
> is a list of cells.
|
||||
Each cell of the list contains one element. This element is a
|
||||
pointer. An iterator (<B
|
||||
CLASS="COMMAND"
|
||||
>clistiter</B
|
||||
>) is a
|
||||
pointer to an element of the list. With an iterator, we can
|
||||
get the previous element of the list, the next element of the
|
||||
list and the content of the element.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="CLIST-NEW"
|
||||
>clist_new and clist_free</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>clist * clist_new(void);
|
||||
|
||||
void clist_free(clist *);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>clist_new()</B
|
||||
> allocates a new empty list and
|
||||
returns it.
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>clist_free()</B
|
||||
> frees the entire list with
|
||||
its cells.
|
||||
</P
|
||||
><DIV
|
||||
CLASS="EXAMPLE"
|
||||
><A
|
||||
NAME="AEN101"
|
||||
></A
|
||||
><P
|
||||
><B
|
||||
>Example 2-5. clist creation</B
|
||||
></P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
clist * list;
|
||||
|
||||
list = clist_new();
|
||||
if (list == NULL)
|
||||
goto err;
|
||||
|
||||
r = clist_append(list, "foo-bar");
|
||||
if (r < 0)
|
||||
|
||||
clist_free(list);
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
free:
|
||||
clist_free(list);
|
||||
err:
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
</PRE
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="CLIST-COUNT"
|
||||
>clist_isempty and clist_count</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int clist_isempty(clist *);
|
||||
|
||||
int clist_count(clist *);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>clist_isempty()</B
|
||||
> returns 1 if the list is
|
||||
empty, else it is 0.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>clist_count()</B
|
||||
> returns the number of
|
||||
elements in the list.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="CLIST-BEGIN"
|
||||
>running through clist</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>clistiter * clist_begin(clist *);
|
||||
|
||||
clistiter * clist_end(clist *);
|
||||
|
||||
clistiter * clist_next(clistiter *);
|
||||
|
||||
clistiter * clist_previous(clistiter *);
|
||||
|
||||
void * clist_content(clistiter *);
|
||||
|
||||
void * clist_nth_data(clist * lst, int index);
|
||||
|
||||
clistiter * clist_nth(clist * lst, int index);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>clist_begin()</B
|
||||
> returns an iterator to the
|
||||
first element of the list.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>clist_end()</B
|
||||
> returns an iterator to the last
|
||||
element of the list.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>clist_next()</B
|
||||
> returns an iterator to the
|
||||
next element of the list.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>clist_previous()</B
|
||||
> returns an iterator to the
|
||||
previous element of the list.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>clist_content()</B
|
||||
> returns the element
|
||||
contained in the cell pointed by the iterator in the list.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>clist_nth()</B
|
||||
> returns an iterator on the
|
||||
<B
|
||||
CLASS="COMMAND"
|
||||
>index</B
|
||||
>-th element of the list.
|
||||
Complexity is O(n).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>clist_nth_data()</B
|
||||
> returns the index-th
|
||||
element of the list.
|
||||
Complexity is O(n).
|
||||
</P
|
||||
><DIV
|
||||
CLASS="EXAMPLE"
|
||||
><A
|
||||
NAME="AEN129"
|
||||
></A
|
||||
><P
|
||||
><B
|
||||
>Example 2-6. displaying content of clist</B
|
||||
></P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
clist * list;
|
||||
clistiter * iter;
|
||||
|
||||
list = build_string_list();
|
||||
if (list == NULL)
|
||||
goto err;
|
||||
|
||||
for(iter = clist_begin(list) ; iter != NULL ; iter =
|
||||
clist_next(iter)) {
|
||||
char * str;
|
||||
|
||||
str = clist_content(iter);
|
||||
printf("%s\n", str);
|
||||
}
|
||||
|
||||
clist_free(list);
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
free:
|
||||
clist_free(list);
|
||||
err:
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
</PRE
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="CLIST-APPEND"
|
||||
>clist modification</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>int clist_prepend(clist *, void *);
|
||||
|
||||
int clist_append(clist *, void *);
|
||||
|
||||
int clist_insert_before(clist *, clistiter *, void *);
|
||||
|
||||
int clist_insert_after(clist *, clistiter *, void *);
|
||||
|
||||
clistiter * clist_delete(clist *, clistiter *);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>clist_prepend()</B
|
||||
> adds an element at the
|
||||
beginning of the list. Returns 0 on sucess, -1 on error.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>clist_append()</B
|
||||
> adds an element at the end
|
||||
of the list. Returns 0 on sucess, -1 on error.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>clist_insert_before()</B
|
||||
> adds an element
|
||||
before the element pointed by the given iterator in the
|
||||
list. Returns 0 on sucess, -1 on error.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>clist_insert_after()</B
|
||||
> adds an element after
|
||||
the element pointed by the given iterator in the list.
|
||||
Returns 0 on sucess, -1 on error.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>clist_delete()</B
|
||||
> the elements pointed by
|
||||
the given iterator in the list and returns an iterator to
|
||||
the next element of the list.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
><DIV
|
||||
CLASS="EXAMPLE"
|
||||
><A
|
||||
NAME="AEN145"
|
||||
></A
|
||||
><P
|
||||
><B
|
||||
>Example 2-7. deleting elements in a clist</B
|
||||
></P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
voir print_content(void * content, void * user_data)
|
||||
{
|
||||
char * str;
|
||||
|
||||
str = content;
|
||||
|
||||
printf("%s\n", str);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
clist * list;
|
||||
clistiter * iter;
|
||||
|
||||
list = build_string_list();
|
||||
if (list == NULL)
|
||||
goto err;
|
||||
|
||||
iter = = clist_begin(list);
|
||||
while (iter != NULL)
|
||||
char * str;
|
||||
|
||||
str = clist_content(iter);
|
||||
if (strcmp(str, "foo-bar") == 0)
|
||||
iter = clist_delete(list, cur);
|
||||
else
|
||||
iter = clist_next(iter);
|
||||
}
|
||||
|
||||
clist_foreach(list, print_content, NULL);
|
||||
printf("\n");
|
||||
|
||||
clist_free(list);
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
free:
|
||||
clist_free(list);
|
||||
err:
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
</PRE
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="CLIST-FOREACH"
|
||||
>clist_foreach</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>typedef void (* clist_func)(void *, void *);
|
||||
|
||||
void clist_foreach(clist * lst, clist_func func, void * data);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>clist_foreach()</B
|
||||
> apply a fonction to each
|
||||
element of the list.
|
||||
Complexity is O(n).
|
||||
</P
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="SECT2"
|
||||
><H2
|
||||
CLASS="SECT2"
|
||||
><A
|
||||
NAME="CLIST-CONCAT"
|
||||
>clist_concat</A
|
||||
></H2
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>void clist_concat(clist * dest, clist * src);
|
||||
</PRE
|
||||
><P
|
||||
> <B
|
||||
CLASS="COMMAND"
|
||||
>clist_concat()</B
|
||||
> adds all the elements of src
|
||||
at the end of dest. Elements are added in the same
|
||||
order. src is an empty list when the operation is finished.
|
||||
Complexity is O(1).
|
||||
</P
|
||||
><DIV
|
||||
CLASS="EXAMPLE"
|
||||
><A
|
||||
NAME="AEN158"
|
||||
></A
|
||||
><P
|
||||
><B
|
||||
>Example 2-8. merging two clists</B
|
||||
></P
|
||||
><PRE
|
||||
CLASS="PROGRAMLISTING"
|
||||
>#include <libetpan/libetpan.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
clist * list;
|
||||
clist * list_2;
|
||||
clistiter * iter;
|
||||
|
||||
list = build_string_list();
|
||||
if (list == NULL)
|
||||
goto err;
|
||||
|
||||
list_2 = build_string_list_2();
|
||||
if (list == NULL)
|
||||
goto free_list;
|
||||
|
||||
clist_concat(list, list_2);
|
||||
clist_free(list_2);
|
||||
|
||||
for(iter = clist_begin(list) ; iter != NULL ; iter =
|
||||
clist_next(iter)) {
|
||||
char * str;
|
||||
|
||||
str = clist_content(iter);
|
||||
printf("%s\n", str);
|
||||
}
|
||||
|
||||
clist_free(list);
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
free_list:
|
||||
clist_free(list);
|
||||
err:
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
</PRE
|
||||
></DIV
|
||||
></DIV
|
||||
></DIV
|
||||
><DIV
|
||||
CLASS="NAVFOOTER"
|
||||
><HR
|
||||
ALIGN="LEFT"
|
||||
WIDTH="100%"><TABLE
|
||||
SUMMARY="Footer navigation table"
|
||||
WIDTH="100%"
|
||||
BORDER="0"
|
||||
CELLPADDING="0"
|
||||
CELLSPACING="0"
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="c16.htm"
|
||||
ACCESSKEY="P"
|
||||
>Prev</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="book1.htm"
|
||||
ACCESSKEY="H"
|
||||
>Home</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="x161.htm"
|
||||
ACCESSKEY="N"
|
||||
>Next</A
|
||||
></TD
|
||||
></TR
|
||||
><TR
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="left"
|
||||
VALIGN="top"
|
||||
>Tools and datatypes</TD
|
||||
><TD
|
||||
WIDTH="34%"
|
||||
ALIGN="center"
|
||||
VALIGN="top"
|
||||
><A
|
||||
HREF="c16.htm"
|
||||
ACCESSKEY="U"
|
||||
>Up</A
|
||||
></TD
|
||||
><TD
|
||||
WIDTH="33%"
|
||||
ALIGN="right"
|
||||
VALIGN="top"
|
||||
>Hash table</TD
|
||||
></TR
|
||||
></TABLE
|
||||
></DIV
|
||||
></BODY
|
||||
></HTML
|
||||
>
|
Reference in New Issue
Block a user