Client HTTP and SMTP

## Functions

int | ulfius_send_http_request (const struct _u_request *request, struct _u_response *response)
int | ulfius_send_http_request_with_limit (const struct _u_request *request, struct _u_response *response, size_t response_body_limit, size_t max_header)
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_http_streaming_request_max_header (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, size_t max_header)
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

  request | the struct _u_request that contains all the input parameters to perform the HTTP request
  response | the 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_request_with_limit()

int ulfius_send_http_request_with_limit | ( | const struct _u_request * | request,
|  | struct _u_response * | response,
|  | size_t | response_body_limit,
|  | size_t | max_header
| ) |  |

ulfius_send_http_request_with_limit Send a HTTP request and store the result into a _u_response The response body lenght and number of parsed headers can be limited

Parameters

  request | the struct _u_request that contains all the input parameters to perform the HTTP request
  response | the struct _u_response that will be filled with all response parameter values, optional, may be NULL
  response_body_limit | the maximum size of the response body to retrieve, 0 means no limit
  max_header | maximum number of headers to parse in the response, 0 means no limit

Returns
  U_OK on success

ulfius_send_http_request_with_limit Send a HTTP request and store the result into a _u_response The number of headers parsed can be limited by max_header, if max_header is 0, the number of headers parsed is unlimited The size of the response body can be limited by response_body_limit, if response_body_limit is 0, no limit to the response body size 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

  request | the struct _u_request that contains all the input parameters to perform the HTTP request
  response | the struct _u_response that will be filled with all response parameter values, optional, may be NULL
  write_body_function | a pointer to a function that will be used to receive response body in chunks
  write_body_data | a 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_http_streaming_request_max_header()

int ulfius_send_http_streaming_request_max_header | ( | 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,
|  | size_t | max_header
| ) |  |

ulfius_send_http_streaming_request_max_header 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 The number of parsed headers in the response can be limited by max_header

Parameters

  request | the struct _u_request that contains all the input parameters to perform the HTTP request
  response | the struct _u_response that will be filled with all response parameter values, optional, may be NULL
  write_body_function | a pointer to a function that will be used to receive response body in chunks
  write_body_data | a user-defined poitner that will be passed in parameter to write_body_function
  max_header | maximum number of headers to parse in the response, 0 means no limit

Returns
  U_OK on success

ulfius_send_http_streaming_request_max_header 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 The number of headers parsed can be limited by max_header, if max_header is 0, the number of headers parsed is unlimited 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

  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)

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

  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)

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