Ulfius
HTTP Framework for REST Applications in C
Functions
Client HTTP and SMTP

Functions

int ulfius_send_http_request (const struct _u_request *request, struct _u_response *response)
 
int ulfius_send_http_streaming_request (const struct _u_request *request, struct _u_response *response, size_t(*write_body_function)(void *contents, size_t size, size_t nmemb, void *user_data), void *write_body_data)
 
int ulfius_send_smtp_email (const char *host, const int port, const int use_tls, const int verify_certificate, const char *user, const char *password, const char *from, const char *to, const char *cc, const char *bcc, const char *subject, const char *mail_body)
 
int ulfius_send_smtp_rich_email (const char *host, const int port, const int use_tls, const int verify_certificate, const char *user, const char *password, const char *from, const char *to, const char *cc, const char *bcc, const char *content_type, const char *subject, const char *mail_body)
 

Detailed Description

client HTTP and SMTP requests management functions

Function Documentation

◆ ulfius_send_http_request()

int ulfius_send_http_request ( const struct _u_request request,
struct _u_response response 
)

ulfius_send_http_request Send a HTTP request and store the result into a _u_response

Parameters
requestthe struct _u_request that contains all the input parameters to perform the HTTP request
responsethe struct _u_response that will be filled with all response parameter values, optional, may be NULL
Returns
U_OK on success

ulfius_send_http_request Send a HTTP request and store the result into a _u_response return U_OK on success

◆ ulfius_send_http_streaming_request()

int ulfius_send_http_streaming_request ( const struct _u_request request,
struct _u_response response,
size_t(*)(void *contents, size_t size, size_t nmemb, void *user_data)  write_body_function,
void *  write_body_data 
)

ulfius_send_http_streaming_request Send a HTTP request and store the result into a _u_response Except for the body which will be available using write_body_function in the write_body_data

Parameters
requestthe struct _u_request that contains all the input parameters to perform the HTTP request
responsethe struct _u_response that will be filled with all response parameter values, optional, may be NULL
write_body_functiona pointer to a function that will be used to receive response body in chunks
write_body_dataa user-defined poitner that will be passed in parameter to write_body_function
Returns
U_OK on success

ulfius_send_http_streaming_request Send a HTTP request and store the result into a _u_response Except for the body which will be available using write_body_function in the write_body_data return U_OK on success

◆ ulfius_send_smtp_email()

int ulfius_send_smtp_email ( const char *  host,
const int  port,
const int  use_tls,
const int  verify_certificate,
const char *  user,
const char *  password,
const char *  from,
const char *  to,
const char *  cc,
const char *  bcc,
const char *  subject,
const char *  mail_body 
)

ulfius_send_smtp_email Send an email using libcurl email is plain/text and UTF8 charset

Parameters
hostsmtp server host name
porttcp port number (optional, 0 for default)
use_tlstrue if the connection is tls secured
verify_certificatetrue if you want to disable the certificate verification on a tls server
userconnection user name (optional, NULL: no user name)
passwordconnection password (optional, NULL: no password)
fromfrom address (mandatory)
toto recipient address (mandatory)
cccc recipient address (optional, NULL: no cc)
bccbcc recipient address (optional, NULL: no bcc)
subjectemail subject (mandatory)
mail_bodyemail body (mandatory)
Returns
U_OK on success

Send an email using libcurl email is plain/text and UTF8 charset host: smtp server host name port: tcp port number (optional, 0 for default) use_tls: true if the connection is tls secured verify_certificate: true if you want to disable the certificate verification on a tls server user: connection user name (optional, NULL: no user name) password: connection password (optional, NULL: no password) from: from address (mandatory) to: to recipient address (mandatory) cc: cc recipient address (optional, NULL: no cc) bcc: bcc recipient address (optional, NULL: no bcc) subject: email subject (mandatory) mail_body: email body (mandatory) return U_OK on success

◆ ulfius_send_smtp_rich_email()

int ulfius_send_smtp_rich_email ( const char *  host,
const int  port,
const int  use_tls,
const int  verify_certificate,
const char *  user,
const char *  password,
const char *  from,
const char *  to,
const char *  cc,
const char *  bcc,
const char *  content_type,
const char *  subject,
const char *  mail_body 
)

Send an email using libcurl email has the content-type specified in parameter

Parameters
hostsmtp server host name
porttcp port number (optional, 0 for default)
use_tlstrue if the connection is tls secured
verify_certificatetrue if you want to disable the certificate verification on a tls server
userconnection user name (optional, NULL: no user name)
passwordconnection password (optional, NULL: no password)
fromfrom address (mandatory)
toto recipient address (mandatory)
cccc recipient address (optional, NULL: no cc)
bccbcc recipient address (optional, NULL: no bcc)
content_typecontent-type to add to the e-mail body
subjectemail subject (mandatory)
mail_bodyemail body (mandatory)
Returns
U_OK on success

Send an email using libcurl email has the content-type specified in parameter host: smtp server host name port: tcp port number (optional, 0 for default) use_tls: true if the connection is tls secured verify_certificate: true if you want to disable the certificate verification on a tls server user: connection user name (optional, NULL: no user name) password: connection password (optional, NULL: no password) from: from address (mandatory) to: to recipient address (mandatory) cc: cc recipient address (optional, NULL: no cc) bcc: bcc recipient address (optional, NULL: no bcc) content_type: content-type to add to the e-mail body subject: email subject (mandatory) mail_body: email body (mandatory) return U_OK on success