#ifndef PSM_H
#define PSM_H 1
#define PSM_OPT_REQUEST_OURS 0x01
#define PSM_OPT_ACCEPT_OURS 0x02
#define PSM_OPT_REJECT_OURS 0x04
#define PSM_OPT_ENABLED_OURS 0x08
#define PSM_OPT_REQUEST_PEERS 0x10
#define PSM_OPT_ACCEPT_PEERS 0x20
#define PSM_OPT_REJECT_PEERS 0x40
#define PSM_OPT_ENABLED_PEERS 0x80
#define psm_peer_opt_is_requested(psm, confopt) \
(((psm)->opt.confopt & PSM_OPT_REQUEST_PEERS) != 0)
#define psm_peer_opt_set_requested(psm, confopt, boolval) \
do { \
if ((boolval)) { \
(psm)->opt.confopt |= PSM_OPT_REQUEST_PEERS; \
} else { \
(psm)->opt.confopt &= ~PSM_OPT_REQUEST_PEERS; \
} \
} while (0)
#define psm_opt_is_requested(psm, confopt) \
(((psm)->opt.confopt & PSM_OPT_REQUEST_OURS) != 0)
#define psm_opt_set_requested(psm, confopt, boolval) \
do { \
if ((boolval)) { \
(psm)->opt.confopt |= PSM_OPT_REQUEST_OURS; \
} else { \
(psm)->opt.confopt &= ~PSM_OPT_REQUEST_OURS; \
} \
} while (0)
#define psm_peer_opt_is_accepted(psm, confopt) \
(((psm)->opt.confopt & PSM_OPT_ACCEPT_PEERS) != 0)
#define psm_peer_opt_set_accepted(psm, confopt, boolval) \
do { \
if ((boolval)) { \
(psm)->opt.confopt |= PSM_OPT_ACCEPT_PEERS; \
} else { \
(psm)->opt.confopt &= ~PSM_OPT_ACCEPT_PEERS; \
} \
} while (0)
#define psm_opt_is_accepted(psm, confopt) \
(((psm)->opt.confopt & PSM_OPT_ACCEPT_OURS) != 0)
#define psm_opt_set_accepted(psm, confopt, boolval) \
do { \
if ((boolval)) { \
(psm)->opt.confopt |= PSM_OPT_ACCEPT_OURS; \
} else { \
(psm)->opt.confopt &= ~PSM_OPT_ACCEPT_OURS; \
} \
} while (0)
#define psm_peer_opt_is_rejected(psm, confopt) \
(((psm)->opt.confopt & PSM_OPT_REJECT_PEERS) != 0)
#define psm_peer_opt_set_rejected(psm, confopt, boolval) \
do { \
if ((boolval)) { \
(psm)->opt.confopt |= PSM_OPT_REJECT_PEERS; \
} else { \
(psm)->opt.confopt &= ~PSM_OPT_REJECT_PEERS; \
} \
} while (0)
#define psm_opt_is_rejected(psm, confopt) \
(((psm)->opt.confopt & PSM_OPT_REJECT_OURS) != 0)
#define psm_opt_set_rejected(psm, confopt, boolval) \
do { \
if ((boolval)) { \
(psm)->opt.confopt |= PSM_OPT_REJECT_OURS; \
} else { \
(psm)->opt.confopt &= ~PSM_OPT_REJECT_OURS; \
} \
} while (0)
#define psm_peer_opt_is_enabled(psm, confopt) \
(((psm)->opt.confopt & PSM_OPT_ENABLED_PEERS) != 0)
#define psm_peer_opt_set_enabled(psm, confopt, boolval) \
do { \
if ((boolval)) { \
(psm)->opt.confopt |= PSM_OPT_ENABLED_PEERS; \
} else { \
(psm)->opt.confopt &= ~PSM_OPT_ENABLED_PEERS; \
} \
} while (0)
#define psm_opt_is_enabled(psm, confopt) \
(((psm)->opt.confopt & PSM_OPT_ENABLED_OURS) != 0)
#define psm_opt_set_enabled(psm, confopt, boolval) \
do { \
if ((boolval)) { \
(psm)->opt.confopt |= PSM_OPT_ENABLED_OURS; \
} else { \
(psm)->opt.confopt &= ~PSM_OPT_ENABLED_OURS; \
} \
} while (0)
#endif