ec_message_context_set

March 26, 2020 Contributors

Name

ec_message_context_set — Store a key/value pair in the appropriate context dictionary

Synopsis

#include "ec_message.h"

| int **ec_message_context_set** ( | m, |   |
|   | w, |   |
|   | k, |   |
|   | v); |   |

ec_message * <var class="pdparam">m</var>;
int <var class="pdparam">w</var>;
const char * <var class="pdparam">k</var>;
const char * <var class="pdparam">v</var>;

Description

Store a key/value pair in the appropriate context dictionary, either ECMESS_CTX_CONN or ECMESS_CTX_MESS

Parameters

message

A pointer to an ec_message struct. For documentation of this data structure see “ec_message”

w

An integer. Valid values are either ECMESS_CTX_CONN or ECMESS_CTX_MESS.

k

A constant string (char *) which is the dictionary key.

v

A constant string (char *) which is the dictionary value.

Return Values

Returns 1 if the key/value pair was successfully added to the appropriate dictionary. Returns 0 if you pass in a NULL value of k or v. Also returns 0 if the key/value pair already existed in the appropriate dictionary.

Threading

It is legal to call this function in any thread.

See Also

ec_message_context_exists,ec_message_context_exists_and_get, and ec_message_context_delete