+ VDBG (1, "VCL<%d>: EPOLL_CTL_MOD: vep_idx %u, sid %u, events 0x%x,"
+ " data 0x%llx!", getpid (), vep_idx, session_index, event->events,
+ event->data.u64);
+ break;
+
+ case EPOLL_CTL_DEL:
+ if (PREDICT_FALSE (!session->is_vep_session))
+ {
+ clib_warning ("VCL<%d>: ERROR: sid %u EPOLL_CTL_DEL: "
+ "not a vep session!", getpid (), session_index);
+ rv = VPPCOM_EINVAL;
+ goto done;
+ }
+ else if (PREDICT_FALSE (session->vep.vep_idx != vep_idx))
+ {
+ clib_warning ("VCL<%d>: ERROR: sid %u EPOLL_CTL_DEL: "
+ "vep_idx (%u) != vep_idx (%u)!",
+ getpid (), session_index,
+ session->vep.vep_idx, vep_idx);
+ rv = VPPCOM_EINVAL;
+ goto done;
+ }
+
+ /* VCL Event Un-register handler */
+ if ((session->session_state & STATE_LISTEN) && vep_session->poll_reg)
+ {
+ (void) vce_unregister_handler (&vcm->event_thread,
+ vep_session->poll_reg);
+ }
+
+ vep_session->wait_cont_idx =
+ (vep_session->wait_cont_idx == session_index) ?
+ session->vep.next_sid : vep_session->wait_cont_idx;
+
+ if (session->vep.prev_sid == vep_idx)
+ vep_session->vep.next_sid = session->vep.next_sid;
+ else
+ {
+ vcl_session_t *prev_session;
+ rv = vppcom_session_at_index (session->vep.prev_sid, &prev_session);
+ if (PREDICT_FALSE (rv))
+ {
+ clib_warning ("VCL<%d>: ERROR: EPOLL_CTL_DEL: Invalid "
+ "vep.prev_sid (%u) on sid (%u)!",
+ getpid (), session->vep.prev_sid, session_index);
+ goto done;
+ }
+ ASSERT (prev_session->vep.next_sid == session_index);
+ prev_session->vep.next_sid = session->vep.next_sid;
+ }
+ if (session->vep.next_sid != ~0)
+ {
+ vcl_session_t *next_session;
+ rv = vppcom_session_at_index (session->vep.next_sid, &next_session);
+ if (PREDICT_FALSE (rv))
+ {
+ clib_warning ("VCL<%d>: ERROR: EPOLL_CTL_DEL: Invalid "
+ "vep.next_sid (%u) on sid (%u)!",
+ getpid (), session->vep.next_sid, session_index);
+ goto done;
+ }
+ ASSERT (next_session->vep.prev_sid == session_index);
+ next_session->vep.prev_sid = session->vep.prev_sid;
+ }
+
+ memset (&session->vep, 0, sizeof (session->vep));
+ session->vep.next_sid = ~0;
+ session->vep.prev_sid = ~0;
+ session->vep.vep_idx = ~0;
+ session->is_vep_session = 0;
+ VDBG (1, "VCL<%d>: EPOLL_CTL_DEL: vep_idx %u, sid %u!",
+ getpid (), vep_idx, session_index);
+ vcl_evt (VCL_EVT_EPOLL_CTLDEL, session, vep_idx);
+ break;
+
+ default:
+ clib_warning ("VCL<%d>: ERROR: Invalid operation (%d)!", getpid (), op);
+ rv = VPPCOM_EINVAL;
+ }
+
+ vep_verify_epoll_chain (vep_idx);
+
+done:
+ VCL_SESSION_UNLOCK ();
+ return rv;
+}
+
+int
+vppcom_epoll_wait (uint32_t vep_idx, struct epoll_event *events,
+ int maxevents, double wait_for_time)
+{
+ vcl_session_t *vep_session;
+ int rv;
+ f64 timeout = clib_time_now (&vcm->clib_time) + wait_for_time;
+ u32 keep_trying = 1;
+ int num_ev = 0;
+ u32 vep_next_sid, wait_cont_idx;
+ u8 is_vep;
+
+ if (PREDICT_FALSE (maxevents <= 0))
+ {
+ clib_warning ("VCL<%d>: ERROR: Invalid maxevents (%d)!",
+ getpid (), maxevents);
+ return VPPCOM_EINVAL;
+ }
+ memset (events, 0, sizeof (*events) * maxevents);
+
+ VCL_SESSION_LOCK_AND_GET (vep_idx, &vep_session);
+ vep_next_sid = vep_session->vep.next_sid;
+ is_vep = vep_session->is_vep;
+ wait_cont_idx = vep_session->wait_cont_idx;
+ VCL_SESSION_UNLOCK ();
+
+ if (PREDICT_FALSE (!is_vep))
+ {
+ clib_warning ("VCL<%d>: ERROR: vep_idx (%u) is not a vep!",
+ getpid (), vep_idx);
+ rv = VPPCOM_EINVAL;
+ goto done;
+ }
+ if (PREDICT_FALSE (vep_next_sid == ~0))
+ {
+ VDBG (1, "VCL<%d>: WARNING: vep_idx (%u) is empty!",
+ getpid (), vep_idx);
+ goto done;
+ }
+
+ do
+ {
+ u32 sid;
+ u32 next_sid = ~0;
+ vcl_session_t *session;
+
+ for (sid = (wait_cont_idx == ~0) ? vep_next_sid : wait_cont_idx;
+ sid != ~0; sid = next_sid)
+ {
+ u32 session_events, et_mask, clear_et_mask, session_vep_idx;
+ u8 add_event, is_vep_session;
+ int ready;
+ u64 session_ev_data;
+
+ VCL_SESSION_LOCK_AND_GET (sid, &session);
+ next_sid = session->vep.next_sid;
+ session_events = session->vep.ev.events;
+ et_mask = session->vep.et_mask;
+ is_vep = session->is_vep;
+ is_vep_session = session->is_vep_session;
+ session_vep_idx = session->vep.vep_idx;
+ session_ev_data = session->vep.ev.data.u64;
+
+ VCL_SESSION_UNLOCK ();
+
+ if (PREDICT_FALSE (is_vep))
+ {
+ VDBG (0, "VCL<%d>: ERROR: sid (%u) is a vep!",
+ getpid (), vep_idx);
+ rv = VPPCOM_EINVAL;
+ goto done;
+ }
+ if (PREDICT_FALSE (!is_vep_session))
+ {
+ VDBG (0, "VCL<%d>: ERROR: session (%u) is not "
+ "a vep session!", getpid (), sid);
+ rv = VPPCOM_EINVAL;
+ goto done;
+ }
+ if (PREDICT_FALSE (session_vep_idx != vep_idx))
+ {
+ clib_warning ("VCL<%d>: ERROR: session (%u) "
+ "vep_idx (%u) != vep_idx (%u)!",
+ getpid (), sid, session_vep_idx, vep_idx);
+ rv = VPPCOM_EINVAL;
+ goto done;
+ }
+
+ add_event = clear_et_mask = 0;
+
+ if (EPOLLIN & session_events)
+ {
+ VCL_SESSION_LOCK_AND_GET (sid, &session);
+ ready = vppcom_session_read_ready (session, sid);
+ VCL_SESSION_UNLOCK ();
+ if ((ready > 0) && (EPOLLIN & et_mask))
+ {
+ add_event = 1;
+ events[num_ev].events |= EPOLLIN;
+ if (((EPOLLET | EPOLLIN) & session_events) ==
+ (EPOLLET | EPOLLIN))
+ clear_et_mask |= EPOLLIN;
+ }
+ else if (ready < 0)
+ {
+ add_event = 1;
+ switch (ready)
+ {
+ case VPPCOM_ECONNRESET:
+ events[num_ev].events |= EPOLLHUP | EPOLLRDHUP;
+ break;
+
+ default:
+ events[num_ev].events |= EPOLLERR;
+ break;
+ }
+ }
+ }
+
+ if (EPOLLOUT & session_events)
+ {
+ VCL_SESSION_LOCK_AND_GET (sid, &session);
+ ready = vppcom_session_write_ready (session, sid);
+ VCL_SESSION_UNLOCK ();
+ if ((ready > 0) && (EPOLLOUT & et_mask))
+ {
+ add_event = 1;
+ events[num_ev].events |= EPOLLOUT;
+ if (((EPOLLET | EPOLLOUT) & session_events) ==
+ (EPOLLET | EPOLLOUT))
+ clear_et_mask |= EPOLLOUT;
+ }
+ else if (ready < 0)
+ {
+ add_event = 1;
+ switch (ready)
+ {
+ case VPPCOM_ECONNRESET:
+ events[num_ev].events |= EPOLLHUP;
+ break;
+
+ default:
+ events[num_ev].events |= EPOLLERR;
+ break;
+ }
+ }
+ }
+
+ if (add_event)
+ {
+ events[num_ev].data.u64 = session_ev_data;
+ if (EPOLLONESHOT & session_events)
+ {
+ VCL_SESSION_LOCK_AND_GET (sid, &session);
+ session->vep.ev.events = 0;
+ VCL_SESSION_UNLOCK ();
+ }
+ num_ev++;
+ if (num_ev == maxevents)
+ {
+ VCL_SESSION_LOCK_AND_GET (vep_idx, &vep_session);
+ vep_session->wait_cont_idx = next_sid;
+ VCL_SESSION_UNLOCK ();
+ goto done;
+ }
+ }
+ if (wait_cont_idx != ~0)
+ {
+ if (next_sid == ~0)
+ next_sid = vep_next_sid;
+ else if (next_sid == wait_cont_idx)
+ next_sid = ~0;
+ }
+ }
+ if (wait_for_time != -1)
+ keep_trying = (clib_time_now (&vcm->clib_time) <= timeout) ? 1 : 0;
+ }
+ while ((num_ev == 0) && keep_trying);
+
+ if (wait_cont_idx != ~0)
+ {
+ VCL_SESSION_LOCK_AND_GET (vep_idx, &vep_session);
+ vep_session->wait_cont_idx = ~0;
+ VCL_SESSION_UNLOCK ();
+ }
+done:
+ return (rv != VPPCOM_OK) ? rv : num_ev;
+}
+
+int
+vppcom_session_attr (uint32_t session_index, uint32_t op,
+ void *buffer, uint32_t * buflen)
+{
+ vcl_session_t *session;
+ int rv = VPPCOM_OK;
+ u32 *flags = buffer;
+ vppcom_endpt_t *ep = buffer;
+
+ VCL_SESSION_LOCK_AND_GET (session_index, &session);
+
+ ASSERT (session);
+
+ switch (op)
+ {
+ case VPPCOM_ATTR_GET_NREAD:
+ rv = vppcom_session_read_ready (session, session_index);
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_GET_NREAD: sid %u, nread = %d",
+ getpid (), rv);
+ break;
+
+ case VPPCOM_ATTR_GET_NWRITE:
+ rv = vppcom_session_write_ready (session, session_index);
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_GET_NWRITE: sid %u, nwrite = %d",
+ getpid (), session_index, rv);
+ break;
+
+ case VPPCOM_ATTR_GET_FLAGS:
+ if (PREDICT_TRUE (buffer && buflen && (*buflen >= sizeof (*flags))))
+ {
+ *flags = O_RDWR | (VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_NONBLOCK));
+ *buflen = sizeof (*flags);
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_GET_FLAGS: sid %u, flags = 0x%08x, "
+ "is_nonblocking = %u", getpid (),
+ session_index, *flags,
+ VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_NONBLOCK));
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_SET_FLAGS:
+ if (PREDICT_TRUE (buffer && buflen && (*buflen == sizeof (*flags))))
+ {
+ if (*flags & O_NONBLOCK)
+ VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_NONBLOCK);
+ else
+ VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_NONBLOCK);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_SET_FLAGS: sid %u, flags = 0x%08x,"
+ " is_nonblocking = %u",
+ getpid (), session_index, *flags,
+ VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_NONBLOCK));
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_PEER_ADDR:
+ if (PREDICT_TRUE (buffer && buflen &&
+ (*buflen >= sizeof (*ep)) && ep->ip))
+ {
+ ep->is_ip4 = session->transport.is_ip4;
+ ep->port = session->transport.rmt_port;
+ if (session->transport.is_ip4)
+ clib_memcpy (ep->ip, &session->transport.rmt_ip.ip4,
+ sizeof (ip4_address_t));
+ else
+ clib_memcpy (ep->ip, &session->transport.rmt_ip.ip6,
+ sizeof (ip6_address_t));
+ *buflen = sizeof (*ep);
+ VDBG (1, "VCL<%d>: VPPCOM_ATTR_GET_PEER_ADDR: sid %u, is_ip4 = %u, "
+ "addr = %U, port %u", getpid (),
+ session_index, ep->is_ip4, format_ip46_address,
+ &session->transport.rmt_ip,
+ ep->is_ip4 ? IP46_TYPE_IP4 : IP46_TYPE_IP6,
+ clib_net_to_host_u16 (ep->port));
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_LCL_ADDR:
+ if (PREDICT_TRUE (buffer && buflen &&
+ (*buflen >= sizeof (*ep)) && ep->ip))
+ {
+ ep->is_ip4 = session->transport.is_ip4;
+ ep->port = session->transport.lcl_port;
+ if (session->transport.is_ip4)
+ clib_memcpy (ep->ip, &session->transport.lcl_ip.ip4,
+ sizeof (ip4_address_t));
+ else
+ clib_memcpy (ep->ip, &session->transport.lcl_ip.ip6,
+ sizeof (ip6_address_t));
+ *buflen = sizeof (*ep);
+ VDBG (1, "VCL<%d>: VPPCOM_ATTR_GET_LCL_ADDR: sid %u, is_ip4 = %u,"
+ " addr = %U port %d", getpid (),
+ session_index, ep->is_ip4, format_ip46_address,
+ &session->transport.lcl_ip,
+ ep->is_ip4 ? IP46_TYPE_IP4 : IP46_TYPE_IP6,
+ clib_net_to_host_u16 (ep->port));
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_LIBC_EPFD:
+ rv = session->libc_epfd;
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_GET_LIBC_EPFD: libc_epfd %d",
+ getpid (), rv);
+ break;
+
+ case VPPCOM_ATTR_SET_LIBC_EPFD:
+ if (PREDICT_TRUE (buffer && buflen &&
+ (*buflen == sizeof (session->libc_epfd))))
+ {
+ session->libc_epfd = *(int *) buffer;
+ *buflen = sizeof (session->libc_epfd);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_SET_LIBC_EPFD: libc_epfd %d, "
+ "buflen %d", getpid (), session->libc_epfd, *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_PROTOCOL:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ *(int *) buffer = session->session_type;
+ *buflen = sizeof (int);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_GET_PROTOCOL: %d (%s), buflen %d",
+ getpid (), *(int *) buffer, *(int *) buffer ? "UDP" : "TCP",
+ *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_LISTEN:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_LISTEN);
+ *buflen = sizeof (int);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_GET_LISTEN: %d, buflen %d",
+ getpid (), *(int *) buffer, *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_ERROR:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ *(int *) buffer = 0;
+ *buflen = sizeof (int);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_GET_ERROR: %d, buflen %d, #VPP-TBD#",
+ getpid (), *(int *) buffer, *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_TX_FIFO_LEN:
+ if (buffer && buflen && (*buflen >= sizeof (u32)))
+ {
+
+ /* VPP-TBD */
+ *(size_t *) buffer = (session->sndbuf_size ? session->sndbuf_size :
+ session->tx_fifo ? session->tx_fifo->nitems :
+ vcm->cfg.tx_fifo_size);
+ *buflen = sizeof (u32);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_GET_TX_FIFO_LEN: %u (0x%x), "
+ "buflen %d, #VPP-TBD#", getpid (),
+ *(size_t *) buffer, *(size_t *) buffer, *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_SET_TX_FIFO_LEN:
+ if (buffer && buflen && (*buflen == sizeof (u32)))
+ {
+ /* VPP-TBD */
+ session->sndbuf_size = *(u32 *) buffer;
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_SET_TX_FIFO_LEN: %u (0x%x), "
+ "buflen %d, #VPP-TBD#", getpid (),
+ session->sndbuf_size, session->sndbuf_size, *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_RX_FIFO_LEN:
+ if (buffer && buflen && (*buflen >= sizeof (u32)))
+ {
+
+ /* VPP-TBD */
+ *(size_t *) buffer = (session->rcvbuf_size ? session->rcvbuf_size :
+ session->rx_fifo ? session->rx_fifo->nitems :
+ vcm->cfg.rx_fifo_size);
+ *buflen = sizeof (u32);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_GET_RX_FIFO_LEN: %u (0x%x), "
+ "buflen %d, #VPP-TBD#", getpid (),
+ *(size_t *) buffer, *(size_t *) buffer, *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_SET_RX_FIFO_LEN:
+ if (buffer && buflen && (*buflen == sizeof (u32)))
+ {
+ /* VPP-TBD */
+ session->rcvbuf_size = *(u32 *) buffer;
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_SET_RX_FIFO_LEN: %u (0x%x), "
+ "buflen %d, #VPP-TBD#", getpid (),
+ session->sndbuf_size, session->sndbuf_size, *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_REUSEADDR:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ /* VPP-TBD */
+ *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_REUSEADDR);
+ *buflen = sizeof (int);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_GET_REUSEADDR: %d, "
+ "buflen %d, #VPP-TBD#", getpid (), *(int *) buffer, *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_SET_REUSEADDR:
+ if (buffer && buflen && (*buflen == sizeof (int)) &&
+ !VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_LISTEN))
+ {
+ /* VPP-TBD */
+ if (*(int *) buffer)
+ VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_REUSEADDR);
+ else
+ VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_REUSEADDR);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_SET_REUSEADDR: %d, buflen %d,"
+ " #VPP-TBD#", getpid (),
+ VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_REUSEADDR), *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_REUSEPORT:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ /* VPP-TBD */
+ *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_REUSEPORT);
+ *buflen = sizeof (int);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_GET_REUSEPORT: %d, buflen %d,"
+ " #VPP-TBD#", getpid (), *(int *) buffer, *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_SET_REUSEPORT:
+ if (buffer && buflen && (*buflen == sizeof (int)) &&
+ !VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_LISTEN))
+ {
+ /* VPP-TBD */
+ if (*(int *) buffer)
+ VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_REUSEPORT);
+ else
+ VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_REUSEPORT);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_SET_REUSEPORT: %d, buflen %d,"
+ " #VPP-TBD#", getpid (),
+ VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_REUSEPORT), *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_BROADCAST:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ /* VPP-TBD */
+ *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_BROADCAST);
+ *buflen = sizeof (int);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_GET_BROADCAST: %d, buflen %d,"
+ " #VPP-TBD#", getpid (), *(int *) buffer, *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_SET_BROADCAST:
+ if (buffer && buflen && (*buflen == sizeof (int)))
+ {
+ /* VPP-TBD */
+ if (*(int *) buffer)
+ VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_BROADCAST);
+ else
+ VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_BROADCAST);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_SET_BROADCAST: %d, buflen %d, "
+ "#VPP-TBD#", getpid (),
+ VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_BROADCAST), *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_V6ONLY:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ /* VPP-TBD */
+ *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_V6ONLY);
+ *buflen = sizeof (int);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_GET_V6ONLY: %d, buflen %d, "
+ "#VPP-TBD#", getpid (), *(int *) buffer, *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_SET_V6ONLY:
+ if (buffer && buflen && (*buflen == sizeof (int)))
+ {
+ /* VPP-TBD */
+ if (*(int *) buffer)
+ VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_V6ONLY);
+ else
+ VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_V6ONLY);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_SET_V6ONLY: %d, buflen %d, "
+ "#VPP-TBD#", getpid (),
+ VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_V6ONLY), *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_KEEPALIVE:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ /* VPP-TBD */
+ *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_KEEPALIVE);
+ *buflen = sizeof (int);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_GET_KEEPALIVE: %d, buflen %d, "
+ "#VPP-TBD#", getpid (), *(int *) buffer, *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_SET_KEEPALIVE:
+ if (buffer && buflen && (*buflen == sizeof (int)))
+ {
+ /* VPP-TBD */
+ if (*(int *) buffer)
+ VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_KEEPALIVE);
+ else
+ VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_KEEPALIVE);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_SET_KEEPALIVE: %d, buflen %d, "
+ "#VPP-TBD#", getpid (),
+ VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_KEEPALIVE), *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_TCP_NODELAY:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ /* VPP-TBD */
+ *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_TCP_NODELAY);
+ *buflen = sizeof (int);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_GET_TCP_NODELAY: %d, buflen %d, "
+ "#VPP-TBD#", getpid (), *(int *) buffer, *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_SET_TCP_NODELAY:
+ if (buffer && buflen && (*buflen == sizeof (int)))
+ {
+ /* VPP-TBD */
+ if (*(int *) buffer)
+ VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_TCP_NODELAY);
+ else
+ VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_TCP_NODELAY);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_SET_TCP_NODELAY: %d, buflen %d, "
+ "#VPP-TBD#", getpid (),
+ VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_TCP_NODELAY), *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_TCP_KEEPIDLE:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ /* VPP-TBD */
+ *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_TCP_KEEPIDLE);
+ *buflen = sizeof (int);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_GET_TCP_KEEPIDLE: %d, buflen %d, "
+ "#VPP-TBD#", getpid (), *(int *) buffer, *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_SET_TCP_KEEPIDLE:
+ if (buffer && buflen && (*buflen == sizeof (int)))
+ {
+ /* VPP-TBD */
+ if (*(int *) buffer)
+ VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_TCP_KEEPIDLE);
+ else
+ VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_TCP_KEEPIDLE);
+
+ VDBG (2, "VCL<%d>: VPPCOM_ATTR_SET_TCP_KEEPIDLE: %d, buflen %d, "
+ "#VPP-TBD#", getpid (),
+ VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_TCP_KEEPIDLE), *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;