Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

/opentcp/include/inet/pop3/pop3_client.h File Reference


Detailed Description

Author:
Version:
1.0
Date:
20.8.2002
OpenTCP POP3 function declarations, constants, etc.

Definition in file pop3_client.h.

Go to the source code of this file.

Data Structures

struct  pop3c_struct
 POP3 client structure. More...


Defines

#define POP3C_SENDERMAXLEN   30
#define POP3C_SUBJECTMAXLEN   30
#define POP3C_TOUT   20
#define POP3C_UNINITIALIZED   1
#define POP3C_CLOSED   2
#define POP3C_OPEN_REQUESTED   3
#define POP3C_CONNECTIONOPEN_SENT   4
#define POP3C_CONNECTION_OPENED   5
#define POP3C_SERVER_READY   6
#define POP3C_USERNAME_SENT   7
#define POP3C_USERNAME_ACKED   8
#define POP3C_PASSWORD_SENT   9
#define POP3C_PASSWORD_ACKED   10
#define POP3C_STAT_SENT   11
#define POP3C_STAT_GET   12
#define POP3C_LIST_SENT   13
#define POP3C_LIST_GET   14
#define POP3C_TOP0_SENT   15
#define POP3C_RECEIVING_HEADER   16
#define POP3C_RECEIVING_HDR_FROM   17
#define POP3C_RECEIVING_HDR_SUBJ   18
#define POP3C_TOP0_GET   19
#define POP3C_RETR_SENT   20
#define POP3C_RECEIVING_MSG_HEADER   21
#define POP3C_RECEIVING_MSG   22
#define POP3C_MESSAGE_RECEIVED   23
#define POP3C_DELE_SENT   24
#define POP3C_DELE_ACKED   25
#define POP3C_QUIT_SENT   26
#define POP3C_QUIT_ACKED   27

Functions

INT8 pop3c_connect (UINT32, UINT16)
 Start E-mail reading procedure.

void pop3c_init (void)
 Initialize POP3 client.

UINT8 pop3c_getstate (void)
 Get current POP3 client state.

void pop3c_error (void)
 POP3 client error handler.

void pop3c_data (UINT8)
 Receives E-mail data.

void pop3c_allok (void)
 Indicates succesfull reading of E-mails.

void pop3c_messages (UINT16)
 Invoked to inform user app about the number of new e-mails.

INT16 pop3c_msgoffer (UINT16, UINT32, UINT8 *, UINT8 *)
 Offers e-mail message to the user app.

INT8 pop3c_getusername (UINT8 *)
 Get user name that is to be used for loging to the server.

INT8 pop3c_getpassword (UINT8 *)
 Get password that is to be used for loging to the server.


Define Documentation

#define POP3C_SENDERMAXLEN   30
 

Maximum length for senders' e-mail address including '\0'

Definition at line 69 of file pop3_client.h.

#define POP3C_SUBJECTMAXLEN   30
 

Maximum length of the subject field including '\0'

Definition at line 72 of file pop3_client.h.

#define POP3C_TOUT   20
 

POP3 client timeout in secs

Definition at line 76 of file pop3_client.h.

#define POP3C_UNINITIALIZED   1
 

POP3 state: Not initialized yet

Definition at line 107 of file pop3_client.h.

#define POP3C_CLOSED   2
 

POP3 state: TCP connection closed

Definition at line 108 of file pop3_client.h.

Referenced by pop3c_connect(), and pop3c_init().

#define POP3C_OPEN_REQUESTED   3
 

POP3 state: User has requested mail read

Definition at line 109 of file pop3_client.h.

Referenced by pop3c_connect().

#define POP3C_CONNECTIONOPEN_SENT   4
 

POP3 state: TCP connection request sent

Definition at line 110 of file pop3_client.h.

#define POP3C_CONNECTION_OPENED   5
 

POP3 state: TCP Connection opened

Definition at line 111 of file pop3_client.h.

#define POP3C_SERVER_READY   6
 

POP3 state: POP3 server has indicated +OK

Definition at line 112 of file pop3_client.h.

#define POP3C_USERNAME_SENT   7
 

POP3 state: USER sent by us

Definition at line 113 of file pop3_client.h.

#define POP3C_USERNAME_ACKED   8
 

POP3 state: Server answered username +OK

Definition at line 114 of file pop3_client.h.

#define POP3C_PASSWORD_SENT   9
 

POP3 state: PASS sent by us

Definition at line 115 of file pop3_client.h.

#define POP3C_PASSWORD_ACKED   10
 

POP3 state: Server answered password +OK

Definition at line 116 of file pop3_client.h.

#define POP3C_STAT_SENT   11
 

POP3 state: STAT sent by us

Definition at line 117 of file pop3_client.h.

#define POP3C_STAT_GET   12
 

POP3 state: Server has answered how many messages

Definition at line 118 of file pop3_client.h.

#define POP3C_LIST_SENT   13
 

POP3 state: LIST sent by us

Definition at line 119 of file pop3_client.h.

#define POP3C_LIST_GET   14
 

POP3 state: Server has repld. with the len of msg

Definition at line 120 of file pop3_client.h.

#define POP3C_TOP0_SENT   15
 

POP3 state: TOP x 0 sent by us

Definition at line 121 of file pop3_client.h.

#define POP3C_RECEIVING_HEADER   16
 

POP3 state: We are receiving header

Definition at line 122 of file pop3_client.h.

#define POP3C_RECEIVING_HDR_FROM   17
 

POP3 state: We are parsing 'from:'

Definition at line 123 of file pop3_client.h.

#define POP3C_RECEIVING_HDR_SUBJ   18
 

POP3 state: We are parsing 'subject:'

Definition at line 124 of file pop3_client.h.

#define POP3C_TOP0_GET   19
 

POP3 state: Server has replied with header

Definition at line 125 of file pop3_client.h.

#define POP3C_RETR_SENT   20
 

POP3 state: RETR sent by us

Definition at line 126 of file pop3_client.h.

#define POP3C_RECEIVING_MSG_HEADER   21
 

POP3 state: We are reading the message header

Definition at line 127 of file pop3_client.h.

#define POP3C_RECEIVING_MSG   22
 

POP3 state: Receiving the message

Definition at line 128 of file pop3_client.h.

#define POP3C_MESSAGE_RECEIVED   23
 

POP3 state: Received the message

Definition at line 129 of file pop3_client.h.

#define POP3C_DELE_SENT   24
 

POP3 state: DELE sent by us

Definition at line 130 of file pop3_client.h.

#define POP3C_DELE_ACKED   25
 

POP3 state: Server has replied dele +OK

Definition at line 131 of file pop3_client.h.

#define POP3C_QUIT_SENT   26
 

POP3 state: QUIT sent by us

Definition at line 132 of file pop3_client.h.

#define POP3C_QUIT_ACKED   27
 

POP3 state: Server has replied quit +OK

Definition at line 133 of file pop3_client.h.


Function Documentation

INT8 pop3c_connect UINT32    ip,
UINT16    port
 

Author:
Date:
11.09.2002
Parameters:
ip  IP address of POP3 server from which to read the e-mails
port  Port on the server
Returns:
  • -1 - Error
  • >0 - Connection procedure started (OK)
This function is called by user when she wants to start E-mail reading procedure. The function is responsible of establishing connection to POP3 server. After connection is established the POP3 client engine starts to make callbacks to user functions in order to get username information, data etc.

Definition at line 114 of file pop3_client.c.

References POP3C_CLOSED, POP3C_OPEN_REQUESTED, pop3c_struct::remip, pop3c_struct::remport, pop3c_struct::sochandle, and pop3c_struct::state.

void pop3c_init void   
 

Author:
Date:
12.08.2002
This function should be called once when system starts. Make sure that system services e.g. timers, TCP are initialized before initializing applications!

Definition at line 148 of file pop3_client.c.

References pop3c_struct::charsinheaderbuf, pop3c_struct::curmsghlen, pop3c_struct::curmsgindex, pop3c_struct::curmsgtotlen, pop3c_struct::from, get_timer(), pop3c_struct::headerbuf, pop3c_struct::msgtotal, POP3C_CLOSED, pop3c_init_done, pop3c_struct::remip, pop3c_struct::remport, RESET_SYSTEM, pop3c_struct::sochandle, pop3c_struct::subject, TCP_DEF_TOUT, tcp_getsocket(), TCP_TOS_NORMAL, TCP_TYPE_CLIENT, pop3c_struct::tmrhandle, and pop3c_struct::unacked.

UINT8 pop3c_getstate void   
 

Author:
Date:
10.10.2002
Returns:
Current POP3 client state
Invoke this function to get current state of the POP3 client

Definition at line 194 of file pop3_client.c.

References pop3c_struct::state.

void pop3c_error void   
 

Author:
Date:
11.09.2002
This callback function is called by POP3 Client when there happens error of some kind (timeout, losing of connection etc.).

Definition at line 82 of file pop3c_callbacks.c.

void pop3c_data UINT8    data
 

Author:
Date:
14.10.2002
Parameters:
data  E-mail data as received by POP3 client
This callback function is called by POP3 Client in order to give data to application

Definition at line 183 of file pop3c_callbacks.c.

void pop3c_allok void   
 

Author:
Date:
14.10.2002
This callback function is called by POP3 Client to indicate succesfull reading of E-mails

Definition at line 169 of file pop3c_callbacks.c.

void pop3c_messages UINT16    msgs
 

Author:
Date:
11.09.2002
Parameters:
msgs  Number of new e-mails waiting on the server
This callback function is called by POP3 Client in order to indicate the number of new E-mails on server.

Definition at line 96 of file pop3c_callbacks.c.

INT16 pop3c_msgoffer UINT16    index,
UINT32    msglen,
UINT8 *    from,
UINT8 *    subject
 

Author:
Date:
11.09.2002
Parameters:
index  index number of message
msglen  Length of message data
from  Buffer containing sender (null terminated string)
subject  Buffer containing subject (null terminated string)
Returns:
  • -2 - Reject the e-mail (delete from server)
  • -1 - Skip the e-mail (leave it on server)
  • >=0 - Read and delete the mail from server
This callback function is called by POP3 Client in order to offer the e-mail message to user. User can reject this mail, skip this, mail or read it as indicated with return value

Definition at line 117 of file pop3c_callbacks.c.

INT8 pop3c_getusername UINT8 *    dbuf
 

Author:
Date:
11.09.2002
Parameters:
dbuf  Pointer to buffer to which the username will be stored
Returns:
  • -1 - Error
  • >0 - Number of bytes inserted
This callback function is called by POP3 Client when it wants to know the username of us. The user is responsible of storing that name to destbuf without NULL termination ('\0') and returning number of bytes on that username.

Definition at line 135 of file pop3c_callbacks.c.

INT8 pop3c_getpassword UINT8 *    dbuf
 

Author:
Date:
11.09.2002
Parameters:
dbuf  Pointer to buffer to which the password will be stored
Returns:
  • -1 - Error
  • >0 - Number of bytes inserted
This callback function is called by POP3 Client when it wants to know the password of us. The user is responsible of storing that name to destbuf without NULL termination ('\0') and returning number of bytes on the password.

Definition at line 155 of file pop3c_callbacks.c.


Generated on Sun Aug 3 20:33:00 2003 for OpenTCP by doxygen1.2.18