Session functions

smf_session_get()

Retrieve SMFSession_T structure

1 SMFSession_T *smf_session_get(void);
Return value

smf_session_to_file()

Copy the current message to disk

1 iint smf_session_to_file(char *path);
Parameter
  • path - path for the new message file
Return value
  • returns 0 on success or -1 in case of error

smf_session_header_get()

Gets the value of the first header with the name requested.

1 const char *smf_session_header_get(const char *header_name);
Parameter
  • header_name - name of the wanted header
Return value
  • returns value of header or NULL in case of error

smf_session_header_prepend()

Prepends a header. If value is NULL, a space will be set aside for it (useful for setting the order of headers before values can be obtained for them) otherwise the header will be unset.

1 void smf_session_header_prepend(char *header_name, char *header_value);
Parameter
  • header_name - name of the header
  • header_value - new value for the header

smf_session_header_append()

Appends a header. If value is NULL, a space will be set aside for it (useful for setting the order of headers before values can be obtained for them) otherwise the header will be unset.

1 void smf_session_header_append(char *header_name, char *header_value);
Parameter
  • header_name - name of the header
  • header_value - new value for the header

smf_session_header_set()

Set the value of the specified header. If value is NULL and the header, name, had not been previously set, a space will be set aside for it (useful for setting the order of headers before values can be obtained for them) otherwise the header will be unset.

Note: If there are multiple headers with the specified field name, the first instance of the header will be replaced and further instances will be removed.

1 void smf_session_header_set(char *header_name, char *header_value);
Parameter
  • header_name - name of the header
  • header_value - new value for the header

smf_session_header_remove()

Removed the specified header if it exists

1 void smf_session_header_remove(char *header_name);
Parameter
  • header_name - name of the header

smf_session_header_to_string()

Allocates a string buffer containing the raw rfc822 headers.

1 char *smf_session_header_to_string(void);
Return value
  • returns a string containing the header block.

(*SMFHeaderForeachFunc)

Function signature for the callback to smf_session_header_foreach()

1 typedef void (*SMFHeaderForeachFunc) (const char *name, const char *value, void *user_data);
Parameter
  • name - the field name.
  • value - the field value.
  • user_data - the user-supplied callback data.

smf_session_header_foreach()

Calls func for each header name/value pair.

1 void smf_session_header_foreach(SMFHeaderForeachFunc func, void *user_data);
Parameter
  • func - function to be called for each header.
  • user_data - user data to be passed to the func.

smf_session_subject_prepend()

Prepend text to subject

1 int smf_session_subject_prepend(char *text);
Parameter
  • text - text to prepend
Return value
  • returns 0 on success or -1 in case of error

smf_session_subject_append()

Append text to subject

1 int smf_session_subject_append(char *text);
  • text - text to prepend
Return value
  • returns 0 on success or -1 in case of error

smf_session_get_message()

Retrieve a SMFMessage_T object from the current session.

1 SMFMessage_T *smf_session_get_message(void);
Return value
Powered by SpaceNet