void nn_pipebase_getopt(struct nn_pipebase *self, int level, int option,void *optval, size_t *optvallen) { int rc,intval; if ( level == NN_SOL_SOCKET ) { switch (option) { /* Endpoint options */ case NN_SNDPRIO: intval = self->options.sndprio; break; case NN_RCVPRIO: intval = self->options.rcvprio; break; case NN_IPV4ONLY: intval = self->options.ipv4only; break; /* Fallback to socket options */ default: rc = nn_sock_getopt_inner(self->sock, level,option, optval, optvallen); errnum_assert (rc == 0, -rc); return; } memcpy (optval, &intval,*optvallen < sizeof (int) ? *optvallen : sizeof (int)); *optvallen = sizeof (int); return; } rc = nn_sock_getopt_inner (self->sock, level, option, optval, optvallen); errnum_assert (rc == 0, -rc); }
void nn_ep_getopt (struct nn_ep *self, int level, int option, void *optval, size_t *optvallen) { int rc; rc = nn_sock_getopt_inner (self->sock, level, option, optval, optvallen); errnum_assert (rc == 0, -rc); }
int nn_sock_getopt (struct nn_sock *self, int level, int option, void *optval, size_t *optvallen) { int rc; nn_ctx_enter (&self->ctx); if (nn_slow (self->state == NN_SOCK_STATE_ZOMBIE)) { nn_ctx_leave (&self->ctx); return -ETERM; } rc = nn_sock_getopt_inner (self, level, option, optval, optvallen); nn_ctx_leave (&self->ctx); return rc; }
int nn_sockbase_getopt (struct nn_sockbase *self, int option, void *optval, size_t *optvallen) { return nn_sock_getopt_inner (self->sock, NN_SOL_SOCKET, option, optval, optvallen); }