net: sockets: tls: Add missing symbols for a few options

`TLS_PEER_VERIFY` and `TLS_DTLS_ROLE` options accept specific values,
yet no symbols were defined for them. In result, magic numbers were used
in several places, making the code less readable.

Fix this issue, by adding the missing symbols to the `socket.h` header,
and using them in places where related socket options are set.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2020-01-17 15:45:56 +01:00 committed by Jukka Rissanen
commit 665d195f3a
7 changed files with 15 additions and 6 deletions

View file

@ -122,6 +122,15 @@ struct zsock_pollfd {
/** @} */
/* Valid values for TLS_PEER_VERIFY option */
#define TLS_PEER_VERIFY_NONE 0 /**< Peer verification disabled. */
#define TLS_PEER_VERIFY_OPTIONAL 1 /**< Peer verification optional. */
#define TLS_PEER_VERIFY_REQUIRED 2 /**< Peer verification required. */
/* Valid values for TLS_DTLS_ROLE option */
#define TLS_DTLS_ROLE_CLIENT 0 /**< Client role in a DTLS session. */
#define TLS_DTLS_ROLE_SERVER 1 /**< Server role in a DTLS session. */
struct zsock_addrinfo {
struct zsock_addrinfo *ai_next;
int ai_flags;