sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
smtp.h
Go to the documentation of this file.
1
5#ifndef LWIP_HDR_APPS_SMTP_H
6#define LWIP_HDR_APPS_SMTP_H
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#include "lwip/apps/smtp_opts.h"
13#include "lwip/err.h"
14#include "lwip/prot/iana.h"
15
17#define SMTP_DEFAULT_PORT LWIP_IANA_PORT_SMTP
19#define SMTPS_DEFAULT_PORT LWIP_IANA_PORT_SMTPS
20
22#define SMTP_RESULT_OK 0
24#define SMTP_RESULT_ERR_UNKNOWN 1
26#define SMTP_RESULT_ERR_CONNECT 2
28#define SMTP_RESULT_ERR_HOSTNAME 3
30#define SMTP_RESULT_ERR_CLOSED 4
32#define SMTP_RESULT_ERR_TIMEOUT 5
34#define SMTP_RESULT_ERR_SVR_RESP 6
36#define SMTP_RESULT_ERR_MEM 7
37
46typedef void (*smtp_result_fn)(void *arg, u8_t smtp_result, u16_t srv_err, err_t err);
47
59 const char *from;
60 const char* to;
61 const char* subject;
62 const char* body;
63 smtp_result_fn callback_fn;
64 void* callback_arg;
70};
71
72
73#if SMTP_BODYDH
74
75#ifndef SMTP_BODYDH_BUFFER_SIZE
76#define SMTP_BODYDH_BUFFER_SIZE 256
77#endif /* SMTP_BODYDH_BUFFER_SIZE */
78
79struct smtp_bodydh {
80 u16_t state;
81 u16_t length; /* Length of content in buffer */
82 char buffer[SMTP_BODYDH_BUFFER_SIZE]; /* buffer for generated content */
83#ifdef SMTP_BODYDH_USER_SIZE
84 u8_t user[SMTP_BODYDH_USER_SIZE];
85#endif /* SMTP_BODYDH_USER_SIZE */
86};
87
88enum bdh_retvals_e {
89 BDH_DONE = 0,
90 BDH_WORKING
91};
92
104typedef int (*smtp_bodycback_fn)(void *arg, struct smtp_bodydh *bodydh);
105
106err_t smtp_send_mail_bodycback(const char *from, const char* to, const char* subject,
107 smtp_bodycback_fn bodycback_fn, smtp_result_fn callback_fn, void* callback_arg);
108
109#endif /* SMTP_BODYDH */
110
111
112err_t smtp_set_server_addr(const char* server);
113void smtp_set_server_port(u16_t port);
114#if LWIP_ALTCP && LWIP_ALTCP_TLS
115struct altcp_tls_config;
116void smtp_set_tls_config(struct altcp_tls_config *tls_config);
117#endif
118err_t smtp_set_auth(const char* username, const char* pass);
119err_t smtp_send_mail(const char *from, const char* to, const char* subject, const char* body,
120 smtp_result_fn callback_fn, void* callback_arg);
121err_t smtp_send_mail_static(const char *from, const char* to, const char* subject, const char* body,
122 smtp_result_fn callback_fn, void* callback_arg);
123void smtp_send_mail_int(void *arg);
124#ifdef LWIP_DEBUG
125const char* smtp_result_str(u8_t smtp_result);
126#endif
127
128#ifdef __cplusplus
129}
130#endif
131
132#endif /* LWIP_HDR_APPS_SMTP_H */
void(*) smtp_result_fn(void *arg, u8_t smtp_result, u16_t srv_err, err_t err)
Definition smtp.h:46
u8_t static_data
Definition smtp.h:69