Correct some typos.
Showing
1 changed file
with
51 additions
and
34 deletions
... | @@ -13,10 +13,11 @@ | ... | @@ -13,10 +13,11 @@ |
13 | 13 | ||
14 | @end example | 14 | @end example |
15 | 15 | ||
16 | The purpose of the Post Office Protocol Version 3 (POP3) is to permit a client to download a maildrop from a remote server. It does | 16 | The purpose of the Post Office Protocol Version 3 (POP3) is to permit a client to download a maildrop from a remote |
17 | not provide complex or extensive operation on the maildrop. When the client successfully authenticates, the server acquires an | 17 | server, the protocol does not provide complex or extensive operation on the maildrop. When the client successfully |
18 | exclusive access lock on the mailbox and holds it the entire duration of the session. After the authentication, the session enters | 18 | authenticates, the server acquires an exclusive access lock on the mailbox and holds it the entire duration of the |
19 | transaction state and the client may issues commands to access messages in the mailbox. | 19 | session. After the authentication, the session enters transaction state and the client may issues commands to |
20 | access messages in the mailbox. | ||
20 | @itemize @bullet | 21 | @itemize @bullet |
21 | @item | 22 | @item |
22 | Authorization state | 23 | Authorization state |
... | @@ -58,41 +59,44 @@ Transaction state | ... | @@ -58,41 +59,44 @@ Transaction state |
58 | @end itemize | 59 | @end itemize |
59 | @end itemize | 60 | @end itemize |
60 | 61 | ||
61 | When the command QUIT is issue the session enters the update state. | 62 | When the command QUIT is issue the session enters the update state; |
62 | The servers removes all messages marked deleted, releases the exclusive lock | 63 | the server removes all messages marked deleted, releases the exclusive lock |
63 | and closes the TCP connection. | 64 | and closes the TCP connection. |
64 | 65 | ||
65 | @subsection Commands | 66 | @subsection Commands |
66 | @cindex mu_pop3_t | 67 | @cindex mu_pop3_t |
67 | 68 | ||
68 | An opaque structure @var{mu_pop3_t} is use as a handle for the session, it is allocated and initialized by | 69 | An opaque structure @code{mu_pop3_t} is use as a handle for the session, it is allocated and initialize by |
69 | calling @code{mu_pop3_create ()}. All Functions will wait for a reply from the POP3 server before returning. The duration of the | 70 | calling @code{mu_pop3_create()}. All Functions will wait for a reply from the POP3 server before returning. |
70 | wait can be set by calling @code{mu_pop3_set_timeout ()}, the default is 2 minutes. On the server side, there is also an idle | 71 | The duration of the wait can be set by calling @code{mu_pop3_set_timeout()}, the default is 2 minutes. |
71 | timeout of 10 minutes before the POP3 server closes the connection, although the @cite{RFC 1939} specifies that the minimum | 72 | On the server side, there is also an idle timeout of 10 minutes before the POP3 server closes the connection, |
73 | although the @cite{RFC 1939} specifies that the minimum | ||
72 | default timeout to be ten minutes, many servers have shorter idle period, care should be taken to at least send a | 74 | default timeout to be ten minutes, many servers have shorter idle period, care should be taken to at least send a |
73 | @code{mu_pop3_noop ()} between lengthy period of idle time. Once a successful connection is established with | 75 | @code{mu_pop3_noop()} between lengthy period of idle time. Once a successful connection is established with |
74 | @code{mu_pop3_connect ()}, two built-ins authentications are provided @code{mu_pop3_apop ()} or | 76 | @code{mu_pop3_connect()}, two built-ins authentications are provided @code{mu_pop3_apop ()} or |
75 | @code{mu_pop3_user ()}/@code{mu_pop3_pass ()}. The @code{mu_pop3_stat ()} and @code{mu_pop3_list ()} functions can be use to | 77 | @code{mu_pop3_user()}/@code{mu_pop3_pass()}. The @code{mu_pop3_stat()} and @code{mu_pop3_list ()} functions can be use to |
76 | get the number and size of messages. The functions @code{mu_pop3_list_all ()}, @code{mu_pop3_uidl_all ()} and | 78 | get the number and size of messages. The functions @code{mu_pop3_list_all()}, @code{mu_pop3_uidl_all ()} and |
77 | @code{mu_pop3_capa ()} provide the information by going through there list iterators. Downloading of messages is done via a two methods | 79 | @code{mu_pop3_capa()} save the information in a @code{list_t}. Downloading of messages is done |
78 | @code{mu_pop3_retr ()} or @code{mu_pop3_top ()}; @strong{Caution: Some Internet Service Providers do not permit to leave mail on | 80 | via a two methods @code{mu_pop3_retr()} or @code{mu_pop3_top()}; |
79 | server and the message will be deleted once downloaded}. | 81 | @strong{Caution: Some Internet Service Providers do not permit to leave mail on server and the message will be |
80 | The functions @code{mu_pop3_retr ()} or @code{mu_pop3_top ()} initiates the downloading of the message. | 82 | deleted once downloaded}. |
81 | POP3 provides only a single channel for operation, it means only one operation can be done at a time, all the functions | 83 | POP3 provides only a single channel for operation, it means only one operation can be done at a time, |
82 | will return @code{EINPROGRESS}. | 84 | all the functions will return @code{EINPROGRESS} if an other operation is in progress. |
83 | 85 | ||
84 | 86 | ||
85 | @subsubsection Callbacks | 87 | @subsubsection Callbacks |
86 | The POP3 library does not provide any callbacks, the approach is to leave flow control and policy outside of the | 88 | The POP3 library does not provide any callbacks, the approach is to leave flow control and policy outside of the |
87 | library. The functions do minimal state checking, for example when sending RETR with @code{mu_pop3_retr()} | 89 | library. The functions do minimal state checking, for example when sending RETR with @code{mu_pop3_retr()} |
88 | it is the responsibility of the user to go through the entire message on the stream, any other call will fail. | 90 | it is the responsibility of the user to go through the entire buffer of the stream to terminate the RETR command, |
91 | any other operation will fail, while the RETR is in progress. | ||
89 | To reset the state or break the downloading, the user should disconnect @code{mu_pop3_disconnect()} and reconnect | 92 | To reset the state or break the downloading, the user should disconnect @code{mu_pop3_disconnect()} and reconnect |
90 | @code{mu_pop3_connect()}, after a sufficient waiting period, @strong{Some POP3 server, move the maildrop to a different | 93 | @code{mu_pop3_connect()}, after a sufficient waiting period, @strong{Some POP3 server, move the maildrop to a different |
91 | location after a sudden disconnect, it is necessary to wait before working on the same mailbox, if not the user may | 94 | location after a sudden disconnect, it may be necessary to wait before working on the same mailbox, if not the user may |
92 | receive a ``Mailbox busy''}. | 95 | receive a ``Mailbox busy'' error code}. |
93 | 96 | ||
94 | @example | 97 | @example |
95 | @group | 98 | @group |
99 | /* Example on how to implement a callback mechanism on top of the library. */ | ||
96 | int pop3_list_cb (mu_pop3_t pop3, int msgno, int (*callback_list)(int msgno, size_t octet)) | 100 | int pop3_list_cb (mu_pop3_t pop3, int msgno, int (*callback_list)(int msgno, size_t octet)) |
97 | @{ | 101 | @{ |
98 | size_t octet = 0; | 102 | size_t octet = 0; |
... | @@ -111,7 +115,7 @@ int pop3_list_cb (mu_pop3_t pop3, int msgno, int (*callback_list)(int msgno, siz | ... | @@ -111,7 +115,7 @@ int pop3_list_cb (mu_pop3_t pop3, int msgno, int (*callback_list)(int msgno, siz |
111 | 115 | ||
112 | @deftypefun int mu_pop3_create (mu_pop3_t *@var{pop3}) | 116 | @deftypefun int mu_pop3_create (mu_pop3_t *@var{pop3}) |
113 | 117 | ||
114 | Allocate and initialize a @var{pop3}, only memory is allocated. | 118 | Allocate and initialize a @var{pop3} session, only memory is allocated. |
115 | 119 | ||
116 | Errors: | 120 | Errors: |
117 | @table @code | 121 | @table @code |
... | @@ -128,7 +132,7 @@ When a POP3 session is finished, any data use by the library is release. | ... | @@ -128,7 +132,7 @@ When a POP3 session is finished, any data use by the library is release. |
128 | @deftypefun int mu_pop3_connect (mu_pop3_t @var{pop3}) | 132 | @deftypefun int mu_pop3_connect (mu_pop3_t @var{pop3}) |
129 | 133 | ||
130 | A connection is established on the carrier, if there was any previous connection it is close first. If non-blocking the | 134 | A connection is established on the carrier, if there was any previous connection it is close first. If non-blocking the |
131 | function should be recalled until the return value is not EAGAIN or EINPROGRESS. | 135 | function should be recall until the return value is not EAGAIN or EINPROGRESS. |
132 | 136 | ||
133 | Errors: | 137 | Errors: |
134 | @table @code | 138 | @table @code |
... | @@ -152,6 +156,18 @@ Errors: | ... | @@ -152,6 +156,18 @@ Errors: |
152 | @end table | 156 | @end table |
153 | 157 | ||
154 | @end deftypefun | 158 | @end deftypefun |
159 | |||
160 | @deftypefun int mu_pop3_stls (mu_pop3_t @var{pop3}) | ||
161 | |||
162 | Create a TLS stream from the carrier and sets it as the current carrier for the session. | ||
163 | |||
164 | Errors: | ||
165 | @table @code | ||
166 | @item EINVAL | ||
167 | @end table | ||
168 | |||
169 | @end deftypefun | ||
170 | |||
155 | @cindex POP3 carrier | 171 | @cindex POP3 carrier |
156 | 172 | ||
157 | @deftypefun int mu_pop3_set_carrier (mu_pop3_t @var{pop3}, stream_t @var{carrier}) | 173 | @deftypefun int mu_pop3_set_carrier (mu_pop3_t @var{pop3}, stream_t @var{carrier}) |
... | @@ -163,7 +179,7 @@ Errors: | ... | @@ -163,7 +179,7 @@ Errors: |
163 | @item EINVAL | 179 | @item EINVAL |
164 | @end table | 180 | @end table |
165 | 181 | ||
166 | @end deftp | 182 | @end deftypefun |
167 | 183 | ||
168 | @subsubsection Authentication State | 184 | @subsubsection Authentication State |
169 | @cindex POP3 APOP | 185 | @cindex POP3 APOP |
... | @@ -172,8 +188,8 @@ Errors: | ... | @@ -172,8 +188,8 @@ Errors: |
172 | 188 | ||
173 | APOP offers an alternative to USER/PASS authentication. For intermittent use of POP3, like checking for new mail, it is the | 189 | APOP offers an alternative to USER/PASS authentication. For intermittent use of POP3, like checking for new mail, it is the |
174 | preferred way to authenticate. It reduces the risk of password capture. The @var{user} and the shared @var{secret} are pass | 190 | preferred way to authenticate. It reduces the risk of password capture. The @var{user} and the shared @var{secret} are pass |
175 | to @code{mu_pop3_apop ()}, the MD5 digest is calculated by applying the time-stamp given by the server in the greeting followed by | 191 | to @code{mu_pop3_apop()}, the MD5 digest is calculated by applying the time-stamp given by the server in the greeting |
176 | the @var{secret}. | 192 | followed by the @var{secret}. |
177 | 193 | ||
178 | @end deftypefun | 194 | @end deftypefun |
179 | 195 | ||
... | @@ -450,8 +466,8 @@ Errors: | ... | @@ -450,8 +466,8 @@ Errors: |
450 | 466 | ||
451 | @deftypefun int mu_pop3_writeline (mu_pop3_t @var{pop3}, const char *@var{format}, ...); | 467 | @deftypefun int mu_pop3_writeline (mu_pop3_t @var{pop3}, const char *@var{format}, ...); |
452 | 468 | ||
453 | Copy in the internal buffer of @code{mu_pop3_t} the formatted string, @code{mu_pop3_send ()} should be called later to flush the string | 469 | Copy in the internal buffer of @code{mu_pop3_t} the formatted string @var{format}, |
454 | to the POP3 server. | 470 | @code{mu_pop3_send()} should be called later to flush the string to the POP3 server. |
455 | 471 | ||
456 | Errors: | 472 | Errors: |
457 | @table @code | 473 | @table @code |
... | @@ -461,7 +477,7 @@ Errors: | ... | @@ -461,7 +477,7 @@ Errors: |
461 | 477 | ||
462 | @deftypefun int mu_pop3_sendline (mu_pop3_t @var{pop3}, const char *@var{cmd}); | 478 | @deftypefun int mu_pop3_sendline (mu_pop3_t @var{pop3}, const char *@var{cmd}); |
463 | 479 | ||
464 | Cover function for @code{mu_pop3_writeline ()} and @code{mu_pop3_send ()}. | 480 | Cover function for @code{mu_pop3_writeline()} followed by a @code{mu_pop3_send()}. |
465 | 481 | ||
466 | Errors: | 482 | Errors: |
467 | @table @code | 483 | @table @code |
... | @@ -471,7 +487,8 @@ Errors: | ... | @@ -471,7 +487,8 @@ Errors: |
471 | 487 | ||
472 | @deftypefun int mu_pop3_send (mu_pop3_t @var{pop3}); | 488 | @deftypefun int mu_pop3_send (mu_pop3_t @var{pop3}); |
473 | 489 | ||
474 | Flushes out the strings written by @code{mu_pop3_writeline ()} in the internal buffer to the channel. | 490 | Flushes out the strings written by @code{mu_pop3_writeline ()} in the internal buffer to the |
491 | stream carrier. | ||
475 | 492 | ||
476 | Errors: | 493 | Errors: |
477 | @table @code | 494 | @table @code |
... | @@ -481,8 +498,7 @@ Errors: | ... | @@ -481,8 +498,7 @@ Errors: |
481 | 498 | ||
482 | @deftypefun int mu_pop3_response (mu_pop3_t @var{pop3}, char *@var{buffer}, size_t @var{len}, size_t *@var{plen}) | 499 | @deftypefun int mu_pop3_response (mu_pop3_t @var{pop3}, char *@var{buffer}, size_t @var{len}, size_t *@var{plen}) |
483 | 500 | ||
484 | The last response from the last command is save and can be examine after | 501 | The last response from the last command is save and can be examine after a failure or success. |
485 | a failure or success. | ||
486 | 502 | ||
487 | Errors: | 503 | Errors: |
488 | @table @code | 504 | @table @code |
... | @@ -513,3 +529,4 @@ Errors: | ... | @@ -513,3 +529,4 @@ Errors: |
513 | @end table | 529 | @end table |
514 | 530 | ||
515 | @end deftypefun | 531 | @end deftypefun |
532 | ... | ... |
-
Please register or sign in to post a comment