#include <sys/resource.h>
#include <netinet/tcp.h>
-#include <vcl/vcom_socket_wrapper.h>
-#include <vcl/vcom.h>
+#include <vcl/ldp_socket_wrapper.h>
+#include <vcl/ldp.h>
#include <sys/time.h>
#include <vcl/vppcom.h>
typedef struct
{
int init;
- char app_name[VCOM_APP_NAME_MAX];
+ char app_name[LDP_APP_NAME_MAX];
u32 sid_bit_val;
u32 sid_bit_mask;
u32 debug;
vcl_poll_t *vcl_poll;
u8 select_vcl;
u8 epoll_wait_vcl;
-} vcom_main_t;
-#define VCOM_DEBUG vcom->debug
+} ldp_main_t;
+#define LDP_DEBUG ldp->debug
-static vcom_main_t vcom_main = {
- .sid_bit_val = (1 << VCOM_SID_BIT_MIN),
- .sid_bit_mask = (1 << VCOM_SID_BIT_MIN) - 1,
- .debug = VCOM_DEBUG_INIT,
+static ldp_main_t ldp_main = {
+ .sid_bit_val = (1 << LDP_SID_BIT_MIN),
+ .sid_bit_mask = (1 << LDP_SID_BIT_MIN) - 1,
+ .debug = LDP_DEBUG_INIT,
};
-static vcom_main_t *vcom = &vcom_main;
+static ldp_main_t *ldp = &ldp_main;
/*
* RETURN: 0 on success or -1 on error.
* */
static inline void
-vcom_set_app_name (char *app_name)
+ldp_set_app_name (char *app_name)
{
- int rv = snprintf (vcom->app_name, VCOM_APP_NAME_MAX,
- "vcom-%d-%s", getpid (), app_name);
+ int rv = snprintf (ldp->app_name, LDP_APP_NAME_MAX,
+ "ldp-%d-%s", getpid (), app_name);
- if (rv >= VCOM_APP_NAME_MAX)
- app_name[VCOM_APP_NAME_MAX - 1] = 0;
+ if (rv >= LDP_APP_NAME_MAX)
+ app_name[LDP_APP_NAME_MAX - 1] = 0;
}
static inline char *
-vcom_get_app_name ()
+ldp_get_app_name ()
{
- if (vcom->app_name[0] == '\0')
- vcom_set_app_name ("app");
+ if (ldp->app_name[0] == '\0')
+ ldp_set_app_name ("app");
- return vcom->app_name;
+ return ldp->app_name;
}
static inline int
-vcom_fd_from_sid (u32 sid)
+ldp_fd_from_sid (u32 sid)
{
- if (PREDICT_FALSE (sid >= vcom->sid_bit_val))
+ if (PREDICT_FALSE (sid >= ldp->sid_bit_val))
return -EMFILE;
else
- return (sid | vcom->sid_bit_val);
+ return (sid | ldp->sid_bit_val);
}
static inline int
-vcom_fd_is_sid (int fd)
+ldp_fd_is_sid (int fd)
{
- return ((u32) fd & vcom->sid_bit_val) ? 1 : 0;
+ return ((u32) fd & ldp->sid_bit_val) ? 1 : 0;
}
static inline u32
-vcom_sid_from_fd (int fd)
+ldp_sid_from_fd (int fd)
{
- return (vcom_fd_is_sid (fd) ? ((u32) fd & vcom->sid_bit_mask) :
+ return (ldp_fd_is_sid (fd) ? ((u32) fd & ldp->sid_bit_mask) :
INVALID_SESSION_ID);
}
static inline int
-vcom_init (void)
+ldp_init (void)
{
int rv = 0;
- if (PREDICT_FALSE (!vcom->init))
+ if (PREDICT_FALSE (!ldp->init))
{
- vcom->init = 1;
- rv = vppcom_app_create (vcom_get_app_name ());
+ ldp->init = 1;
+ rv = vppcom_app_create (ldp_get_app_name ());
if (rv == VPPCOM_OK)
{
- char *env_var_str = getenv (VCOM_ENV_DEBUG);
+ char *env_var_str = getenv (LDP_ENV_DEBUG);
if (env_var_str)
{
u32 tmp;
if (sscanf (env_var_str, "%u", &tmp) != 1)
- clib_warning ("LDP<%d>: WARNING: Invalid VCOM debug level "
- "specified in the env var " VCOM_ENV_DEBUG
+ clib_warning ("LDP<%d>: WARNING: Invalid LDP debug level "
+ "specified in the env var " LDP_ENV_DEBUG
" (%s)!", getpid (), env_var_str);
else
{
- vcom->debug = tmp;
- clib_warning ("LDP<%d>: configured VCOM debug level (%u) "
- "from the env var " VCOM_ENV_DEBUG "!",
- getpid (), vcom->debug);
+ ldp->debug = tmp;
+ clib_warning ("LDP<%d>: configured LDP debug level (%u) "
+ "from the env var " LDP_ENV_DEBUG "!",
+ getpid (), ldp->debug);
}
}
- env_var_str = getenv (VCOM_ENV_APP_NAME);
+ env_var_str = getenv (LDP_ENV_APP_NAME);
if (env_var_str)
{
- vcom_set_app_name (env_var_str);
- clib_warning ("LDP<%d>: configured VCOM app name (%s) "
- "from the env var " VCOM_ENV_APP_NAME "!",
- getpid (), vcom->app_name);
+ ldp_set_app_name (env_var_str);
+ clib_warning ("LDP<%d>: configured LDP app name (%s) "
+ "from the env var " LDP_ENV_APP_NAME "!",
+ getpid (), ldp->app_name);
}
- env_var_str = getenv (VCOM_ENV_SID_BIT);
+ env_var_str = getenv (LDP_ENV_SID_BIT);
if (env_var_str)
{
u32 sb;
if (sscanf (env_var_str, "%u", &sb) != 1)
{
- clib_warning ("LDP<%d>: WARNING: Invalid VCOM sid bit "
+ clib_warning ("LDP<%d>: WARNING: Invalid LDP sid bit "
"specified in the env var "
- VCOM_ENV_SID_BIT " (%s)!"
+ LDP_ENV_SID_BIT " (%s)!"
"sid bit value %d (0x%x)",
getpid (), env_var_str,
- vcom->sid_bit_val, vcom->sid_bit_val);
+ ldp->sid_bit_val, ldp->sid_bit_val);
}
- else if (sb < VCOM_SID_BIT_MIN)
+ else if (sb < LDP_SID_BIT_MIN)
{
- vcom->sid_bit_val = (1 << VCOM_SID_BIT_MIN);
- vcom->sid_bit_mask = vcom->sid_bit_val - 1;
+ ldp->sid_bit_val = (1 << LDP_SID_BIT_MIN);
+ ldp->sid_bit_mask = ldp->sid_bit_val - 1;
- clib_warning ("LDP<%d>: WARNING: VCOM sid bit (%u) "
+ clib_warning ("LDP<%d>: WARNING: LDP sid bit (%u) "
"specified in the env var "
- VCOM_ENV_SID_BIT " (%s) is too small. "
- "Using VCOM_SID_BIT_MIN (%d)! "
+ LDP_ENV_SID_BIT " (%s) is too small. "
+ "Using LDP_SID_BIT_MIN (%d)! "
"sid bit value %d (0x%x)",
- getpid (), sb, env_var_str, VCOM_SID_BIT_MIN,
- vcom->sid_bit_val, vcom->sid_bit_val);
+ getpid (), sb, env_var_str, LDP_SID_BIT_MIN,
+ ldp->sid_bit_val, ldp->sid_bit_val);
}
- else if (sb > VCOM_SID_BIT_MAX)
+ else if (sb > LDP_SID_BIT_MAX)
{
- vcom->sid_bit_val = (1 << VCOM_SID_BIT_MAX);
- vcom->sid_bit_mask = vcom->sid_bit_val - 1;
+ ldp->sid_bit_val = (1 << LDP_SID_BIT_MAX);
+ ldp->sid_bit_mask = ldp->sid_bit_val - 1;
- clib_warning ("LDP<%d>: WARNING: VCOM sid bit (%u) "
+ clib_warning ("LDP<%d>: WARNING: LDP sid bit (%u) "
"specified in the env var "
- VCOM_ENV_SID_BIT " (%s) is too big. "
- "Using VCOM_SID_BIT_MAX (%d)! "
+ LDP_ENV_SID_BIT " (%s) is too big. "
+ "Using LDP_SID_BIT_MAX (%d)! "
"sid bit value %d (0x%x)",
- getpid (), sb, env_var_str, VCOM_SID_BIT_MAX,
- vcom->sid_bit_val, vcom->sid_bit_val);
+ getpid (), sb, env_var_str, LDP_SID_BIT_MAX,
+ ldp->sid_bit_val, ldp->sid_bit_val);
}
else
{
- vcom->sid_bit_val = (1 << sb);
- vcom->sid_bit_mask = vcom->sid_bit_val - 1;
+ ldp->sid_bit_val = (1 << sb);
+ ldp->sid_bit_mask = ldp->sid_bit_val - 1;
- clib_warning ("LDP<%d>: configured VCOM sid bit (%u) "
- "from " VCOM_ENV_SID_BIT
+ clib_warning ("LDP<%d>: configured LDP sid bit (%u) "
+ "from " LDP_ENV_SID_BIT
"! sid bit value %d (0x%x)", getpid (),
- sb, vcom->sid_bit_val, vcom->sid_bit_val);
+ sb, ldp->sid_bit_val, ldp->sid_bit_val);
}
}
- clib_time_init (&vcom->clib_time);
- clib_warning ("LDP<%d>: VCOM initialization: done!", getpid ());
+ clib_time_init (&ldp->clib_time);
+ clib_warning ("LDP<%d>: LDP initialization: done!", getpid ());
}
else
{
- fprintf (stderr, "\nLDP<%d>: ERROR: vcom_init: vppcom_app_create()"
+ fprintf (stderr, "\nLDP<%d>: ERROR: ldp_init: vppcom_app_create()"
" failed! rv = %d (%s)\n",
getpid (), rv, vppcom_retval_str (rv));
- vcom->init = 0;
+ ldp->init = 0;
}
}
return rv;
{
int rv;
const char *func_str;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
{
func_str = "libc_close";
- if (VCOM_DEBUG > 0)
+ if (LDP_DEBUG > 0)
clib_warning
("LDP<%d>: fd %d (0x%x): calling %s(): epfd %u (0x%x)",
getpid (), fd, fd, func_str, epfd, epfd);
func_str = "vppcom_session_close";
- if (VCOM_DEBUG > 0)
+ if (LDP_DEBUG > 0)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): sid %u (0x%x)",
getpid (), fd, fd, func_str, sid, sid);
{
func_str = "libc_close";
- if (VCOM_DEBUG > 0)
+ if (LDP_DEBUG > 0)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s()",
getpid (), fd, fd, func_str);
}
done:
- if (VCOM_DEBUG > 0)
+ if (LDP_DEBUG > 0)
{
if (rv < 0)
{
{
ssize_t size;
const char *func_str;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
{
func_str = "vppcom_session_read";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x), buf %p, nbytes %u", getpid (),
fd, fd, func_str, sid, sid, buf, nbytes);
{
func_str = "libc_read";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"buf %p, nbytes %u", getpid (),
fd, fd, func_str, buf, nbytes);
size = libc_read (fd, buf, nbytes);
}
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
{
if (size < 0)
{
{
const char *func_str;
ssize_t size = 0;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
int rv = 0, i, total = 0;
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
{
for (i = 0; i < iovcnt; ++i)
{
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s() [%d]: "
"sid %u (0x%x), iov %p, iovcnt %d, total %d",
getpid (), fd, fd, func_str, i, sid, sid,
total += rv;
if (rv < iov[i].iov_len)
{
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): "
"rv (%d) < iov[%d].iov_len (%d)",
getpid (), fd, fd, rv, i,
{
func_str = "libc_readv";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"iov %p, iovcnt %d", getpid (), fd, fd, iov, iovcnt);
size = libc_readv (fd, iov, iovcnt);
}
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
{
if (size < 0)
{
{
const char *func_str;
ssize_t size = 0;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
{
func_str = "vppcom_session_write";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x), buf %p, nbytes %u", getpid (),
fd, fd, func_str, sid, sid, buf, nbytes);
{
func_str = "libc_write";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"buf %p, nbytes %u", getpid (),
fd, fd, func_str, buf, nbytes);
size = libc_write (fd, buf, nbytes);
}
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
{
if (size < 0)
{
{
const char *func_str;
ssize_t size = 0, total = 0;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
int i, rv = 0;
/*
* Use [f]printf() instead of clib_warning() to prevent recursion SIGSEGV.
*/
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
{
for (i = 0; i < iovcnt; ++i)
{
- if (VCOM_DEBUG > 4)
+ if (LDP_DEBUG > 4)
printf ("%s:%d: LDP<%d>: fd %d (0x%x): calling %s() [%d]: "
"sid %u (0x%x), buf %p, nbytes %ld, total %ld",
__func__, __LINE__, getpid (), fd, fd, func_str,
total += rv;
if (rv < iov[i].iov_len)
{
- if (VCOM_DEBUG > 4)
+ if (LDP_DEBUG > 4)
printf ("%s:%d: LDP<%d>: fd %d (0x%x): "
"rv (%d) < iov[%d].iov_len (%ld)",
__func__, __LINE__, getpid (), fd, fd,
{
func_str = "libc_writev";
- if (VCOM_DEBUG > 4)
+ if (LDP_DEBUG > 4)
printf ("%s:%d: LDP<%d>: fd %d (0x%x): calling %s(): "
"iov %p, iovcnt %d\n", __func__, __LINE__, getpid (),
fd, fd, func_str, iov, iovcnt);
size = libc_writev (fd, iov, iovcnt);
}
- if (VCOM_DEBUG > 4)
+ if (LDP_DEBUG > 4)
{
if (size < 0)
{
const char *func_str = __func__;
int rv = 0;
va_list ap;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
va_start (ap, cmd);
{
case F_SETFL:
func_str = "vppcom_session_attr[SET_FLAGS]";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x) flags %d (0x%x), size %d",
getpid (), fd, fd, func_str, sid, sid,
case F_GETFL:
func_str = "vppcom_session_attr[GET_FLAGS]";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning
("LDP<%d>: fd %d (0x%x): calling %s(): sid %u (0x%x), "
"flags %d (0x%x), size %d", getpid (), fd, fd, func_str, sid,
vppcom_session_attr (sid, VPPCOM_ATTR_GET_FLAGS, &flags, &size);
if (rv == VPPCOM_OK)
{
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x), cmd %d (F_GETFL): "
"%s() returned flags %d (0x%x)",
getpid (), fd, fd, cmd, func_str, flags, flags);
{
func_str = "libc_vfcntl";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): cmd %d",
getpid (), fd, fd, func_str, cmd);
va_end (ap);
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
{
if (rv < 0)
{
const char *func_str;
int rv;
va_list ap;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
va_start (ap, cmd);
switch (cmd)
{
case FIONREAD:
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning
("LDP<%d>: fd %d (0x%x): calling %s(): sid %u (0x%x)",
getpid (), fd, fd, func_str, sid, sid);
* non-blocking, the flags should be read here and merged
* with O_NONBLOCK.
*/
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x), flags %d (0x%x), size %d",
getpid (), fd, fd, func_str, sid, sid,
{
func_str = "libc_vioctl";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): cmd %d",
getpid (), fd, fd, func_str, cmd);
rv = libc_vioctl (fd, cmd, ap);
}
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
{
if (rv < 0)
{
}
int
-vcom_pselect (int nfds, fd_set * __restrict readfds,
- fd_set * __restrict writefds,
- fd_set * __restrict exceptfds,
- const struct timespec *__restrict timeout,
- const __sigset_t * __restrict sigmask)
+ldp_pselect (int nfds, fd_set * __restrict readfds,
+ fd_set * __restrict writefds,
+ fd_set * __restrict exceptfds,
+ const struct timespec *__restrict timeout,
+ const __sigset_t * __restrict sigmask)
{
int rv;
char *func_str = "##";
return -1;
}
- if (nfds <= vcom->sid_bit_val)
+ if (nfds <= ldp->sid_bit_val)
{
func_str = "libc_pselect";
- if (VCOM_DEBUG > 3)
+ if (LDP_DEBUG > 3)
clib_warning
("LDP<%d>: calling %s(): nfds %d, readfds %p, writefds %p, "
"exceptfds %p, timeout %p, sigmask %p", getpid (), func_str, nfds,
goto done;
}
- if (PREDICT_FALSE (vcom->sid_bit_val > FD_SETSIZE / 2))
+ if (PREDICT_FALSE (ldp->sid_bit_val > FD_SETSIZE / 2))
{
- clib_warning ("LDP<%d>: ERROR: VCOM sid bit value %d (0x%x) > "
+ clib_warning ("LDP<%d>: ERROR: LDP sid bit value %d (0x%x) > "
"FD_SETSIZE/2 %d (0x%x)!", getpid (),
- vcom->sid_bit_val, vcom->sid_bit_val,
+ ldp->sid_bit_val, ldp->sid_bit_val,
FD_SETSIZE / 2, FD_SETSIZE / 2);
errno = EOVERFLOW;
return -1;
/* select as fine grained sleep */
if (!nfds)
{
- if (VCOM_DEBUG > 3)
+ if (LDP_DEBUG > 3)
clib_warning ("LDP<%d>: sleeping for %f seconds",
getpid (), time_out);
- time_out += clib_time_now (&vcom->clib_time);
- while (clib_time_now (&vcom->clib_time) < time_out)
+ time_out += clib_time_now (&ldp->clib_time);
+ while (clib_time_now (&ldp->clib_time) < time_out)
;
return 0;
}
sid_bits = libc_bits = 0;
if (readfds)
{
- clib_bitmap_validate (vcom->sid_rd_bitmap, minbits);
- clib_bitmap_validate (vcom->libc_rd_bitmap, minbits);
- clib_bitmap_validate (vcom->rd_bitmap, minbits);
- clib_memcpy (vcom->rd_bitmap, readfds,
- vec_len (vcom->rd_bitmap) * sizeof (clib_bitmap_t));
+ clib_bitmap_validate (ldp->sid_rd_bitmap, minbits);
+ clib_bitmap_validate (ldp->libc_rd_bitmap, minbits);
+ clib_bitmap_validate (ldp->rd_bitmap, minbits);
+ clib_memcpy (ldp->rd_bitmap, readfds,
+ vec_len (ldp->rd_bitmap) * sizeof (clib_bitmap_t));
FD_ZERO (readfds);
/* *INDENT-OFF* */
- clib_bitmap_foreach (fd, vcom->rd_bitmap,
+ clib_bitmap_foreach (fd, ldp->rd_bitmap,
({
- sid = vcom_sid_from_fd (fd);
- if (VCOM_DEBUG > 3)
+ sid = ldp_sid_from_fd (fd);
+ if (LDP_DEBUG > 3)
clib_warning ("LDP<%d>: readfds: fd %d (0x%x), sid %u (0x%x)",
getpid (), fd, fd, sid, sid);
if (sid == INVALID_SESSION_ID)
- clib_bitmap_set_no_check (vcom->libc_rd_bitmap, fd, 1);
+ clib_bitmap_set_no_check (ldp->libc_rd_bitmap, fd, 1);
else
- clib_bitmap_set_no_check (vcom->sid_rd_bitmap, sid, 1);
+ clib_bitmap_set_no_check (ldp->sid_rd_bitmap, sid, 1);
}));
/* *INDENT-ON* */
- sid_bits_set = clib_bitmap_last_set (vcom->sid_rd_bitmap) + 1;
+ sid_bits_set = clib_bitmap_last_set (ldp->sid_rd_bitmap) + 1;
sid_bits = (sid_bits_set > sid_bits) ? sid_bits_set : sid_bits;
- libc_bits_set = clib_bitmap_last_set (vcom->libc_rd_bitmap) + 1;
+ libc_bits_set = clib_bitmap_last_set (ldp->libc_rd_bitmap) + 1;
libc_bits = (libc_bits_set > libc_bits) ? libc_bits_set : libc_bits;
- if (VCOM_DEBUG > 3)
+ if (LDP_DEBUG > 3)
clib_warning ("LDP<%d>: readfds: sid_bits_set %d, sid_bits %d, "
"libc_bits_set %d, libc_bits %d", getpid (),
sid_bits_set, sid_bits, libc_bits_set, libc_bits);
}
if (writefds)
{
- clib_bitmap_validate (vcom->sid_wr_bitmap, minbits);
- clib_bitmap_validate (vcom->libc_wr_bitmap, minbits);
- clib_bitmap_validate (vcom->wr_bitmap, minbits);
- clib_memcpy (vcom->wr_bitmap, writefds,
- vec_len (vcom->wr_bitmap) * sizeof (clib_bitmap_t));
+ clib_bitmap_validate (ldp->sid_wr_bitmap, minbits);
+ clib_bitmap_validate (ldp->libc_wr_bitmap, minbits);
+ clib_bitmap_validate (ldp->wr_bitmap, minbits);
+ clib_memcpy (ldp->wr_bitmap, writefds,
+ vec_len (ldp->wr_bitmap) * sizeof (clib_bitmap_t));
FD_ZERO (writefds);
/* *INDENT-OFF* */
- clib_bitmap_foreach (fd, vcom->wr_bitmap,
+ clib_bitmap_foreach (fd, ldp->wr_bitmap,
({
- sid = vcom_sid_from_fd (fd);
- if (VCOM_DEBUG > 3)
+ sid = ldp_sid_from_fd (fd);
+ if (LDP_DEBUG > 3)
clib_warning ("LDP<%d>: writefds: fd %d (0x%x), sid %u (0x%x)",
getpid (), fd, fd, sid, sid);
if (sid == INVALID_SESSION_ID)
- clib_bitmap_set_no_check (vcom->libc_wr_bitmap, fd, 1);
+ clib_bitmap_set_no_check (ldp->libc_wr_bitmap, fd, 1);
else
- clib_bitmap_set_no_check (vcom->sid_wr_bitmap, sid, 1);
+ clib_bitmap_set_no_check (ldp->sid_wr_bitmap, sid, 1);
}));
/* *INDENT-ON* */
- sid_bits_set = clib_bitmap_last_set (vcom->sid_wr_bitmap) + 1;
+ sid_bits_set = clib_bitmap_last_set (ldp->sid_wr_bitmap) + 1;
sid_bits = (sid_bits_set > sid_bits) ? sid_bits_set : sid_bits;
- libc_bits_set = clib_bitmap_last_set (vcom->libc_wr_bitmap) + 1;
+ libc_bits_set = clib_bitmap_last_set (ldp->libc_wr_bitmap) + 1;
libc_bits = (libc_bits_set > libc_bits) ? libc_bits_set : libc_bits;
- if (VCOM_DEBUG > 3)
+ if (LDP_DEBUG > 3)
clib_warning ("LDP<%d>: writefds: sid_bits_set %d, sid_bits %d, "
"libc_bits_set %d, libc_bits %d", getpid (),
sid_bits_set, sid_bits, libc_bits_set, libc_bits);
}
if (exceptfds)
{
- clib_bitmap_validate (vcom->sid_ex_bitmap, minbits);
- clib_bitmap_validate (vcom->libc_ex_bitmap, minbits);
- clib_bitmap_validate (vcom->ex_bitmap, minbits);
- clib_memcpy (vcom->ex_bitmap, exceptfds,
- vec_len (vcom->ex_bitmap) * sizeof (clib_bitmap_t));
+ clib_bitmap_validate (ldp->sid_ex_bitmap, minbits);
+ clib_bitmap_validate (ldp->libc_ex_bitmap, minbits);
+ clib_bitmap_validate (ldp->ex_bitmap, minbits);
+ clib_memcpy (ldp->ex_bitmap, exceptfds,
+ vec_len (ldp->ex_bitmap) * sizeof (clib_bitmap_t));
FD_ZERO (exceptfds);
/* *INDENT-OFF* */
- clib_bitmap_foreach (fd, vcom->ex_bitmap,
+ clib_bitmap_foreach (fd, ldp->ex_bitmap,
({
- sid = vcom_sid_from_fd (fd);
- if (VCOM_DEBUG > 3)
+ sid = ldp_sid_from_fd (fd);
+ if (LDP_DEBUG > 3)
clib_warning ("LDP<%d>: exceptfds: fd %d (0x%x), sid %u (0x%x)",
getpid (), fd, fd, sid, sid);
if (sid == INVALID_SESSION_ID)
- clib_bitmap_set_no_check (vcom->libc_ex_bitmap, fd, 1);
+ clib_bitmap_set_no_check (ldp->libc_ex_bitmap, fd, 1);
else
- clib_bitmap_set_no_check (vcom->sid_ex_bitmap, sid, 1);
+ clib_bitmap_set_no_check (ldp->sid_ex_bitmap, sid, 1);
}));
/* *INDENT-ON* */
- sid_bits_set = clib_bitmap_last_set (vcom->sid_ex_bitmap) + 1;
+ sid_bits_set = clib_bitmap_last_set (ldp->sid_ex_bitmap) + 1;
sid_bits = (sid_bits_set > sid_bits) ? sid_bits_set : sid_bits;
- libc_bits_set = clib_bitmap_last_set (vcom->libc_ex_bitmap) + 1;
+ libc_bits_set = clib_bitmap_last_set (ldp->libc_ex_bitmap) + 1;
libc_bits = (libc_bits_set > libc_bits) ? libc_bits_set : libc_bits;
- if (VCOM_DEBUG > 3)
+ if (LDP_DEBUG > 3)
clib_warning ("LDP<%d>: exceptfds: sid_bits_set %d, sid_bits %d, "
"libc_bits_set %d, libc_bits %d", getpid (),
sid_bits_set, sid_bits, libc_bits_set, libc_bits);
{
if (sid_bits)
{
- if (!vcom->select_vcl)
+ if (!ldp->select_vcl)
{
func_str = "vppcom_select";
if (readfds)
- clib_memcpy (vcom->rd_bitmap, vcom->sid_rd_bitmap,
- vec_len (vcom->rd_bitmap) *
+ clib_memcpy (ldp->rd_bitmap, ldp->sid_rd_bitmap,
+ vec_len (ldp->rd_bitmap) *
sizeof (clib_bitmap_t));
if (writefds)
- clib_memcpy (vcom->wr_bitmap, vcom->sid_wr_bitmap,
- vec_len (vcom->wr_bitmap) *
+ clib_memcpy (ldp->wr_bitmap, ldp->sid_wr_bitmap,
+ vec_len (ldp->wr_bitmap) *
sizeof (clib_bitmap_t));
if (exceptfds)
- clib_memcpy (vcom->ex_bitmap, vcom->sid_ex_bitmap,
- vec_len (vcom->ex_bitmap) *
+ clib_memcpy (ldp->ex_bitmap, ldp->sid_ex_bitmap,
+ vec_len (ldp->ex_bitmap) *
sizeof (clib_bitmap_t));
rv = vppcom_select (sid_bits,
- readfds ? vcom->rd_bitmap : NULL,
- writefds ? vcom->wr_bitmap : NULL,
- exceptfds ? vcom->ex_bitmap : NULL, 0);
+ readfds ? ldp->rd_bitmap : NULL,
+ writefds ? ldp->wr_bitmap : NULL,
+ exceptfds ? ldp->ex_bitmap : NULL, 0);
if (rv < 0)
{
errno = -rv;
if (readfds)
{
/* *INDENT-OFF* */
- clib_bitmap_foreach (sid, vcom->rd_bitmap,
+ clib_bitmap_foreach (sid, ldp->rd_bitmap,
({
- fd = vcom_fd_from_sid (sid);
+ fd = ldp_fd_from_sid (sid);
if (PREDICT_FALSE (fd < 0))
{
errno = EBADFD;
if (writefds)
{
/* *INDENT-OFF* */
- clib_bitmap_foreach (sid, vcom->wr_bitmap,
+ clib_bitmap_foreach (sid, ldp->wr_bitmap,
({
- fd = vcom_fd_from_sid (sid);
+ fd = ldp_fd_from_sid (sid);
if (PREDICT_FALSE (fd < 0))
{
errno = EBADFD;
if (exceptfds)
{
/* *INDENT-OFF* */
- clib_bitmap_foreach (sid, vcom->ex_bitmap,
+ clib_bitmap_foreach (sid, ldp->ex_bitmap,
({
- fd = vcom_fd_from_sid (sid);
+ fd = ldp_fd_from_sid (sid);
if (PREDICT_FALSE (fd < 0))
{
errno = EBADFD;
}));
/* *INDENT-ON* */
}
- vcom->select_vcl = 1;
+ ldp->select_vcl = 1;
goto done;
}
}
else
- vcom->select_vcl = 0;
+ ldp->select_vcl = 0;
}
if (libc_bits)
{
func_str = "libc_pselect";
if (readfds)
- clib_memcpy (readfds, vcom->libc_rd_bitmap,
- vec_len (vcom->rd_bitmap) * sizeof (clib_bitmap_t));
+ clib_memcpy (readfds, ldp->libc_rd_bitmap,
+ vec_len (ldp->rd_bitmap) * sizeof (clib_bitmap_t));
if (writefds)
- clib_memcpy (writefds, vcom->libc_wr_bitmap,
- vec_len (vcom->wr_bitmap) * sizeof (clib_bitmap_t));
+ clib_memcpy (writefds, ldp->libc_wr_bitmap,
+ vec_len (ldp->wr_bitmap) * sizeof (clib_bitmap_t));
if (exceptfds)
- clib_memcpy (exceptfds, vcom->libc_ex_bitmap,
- vec_len (vcom->ex_bitmap) * sizeof (clib_bitmap_t));
+ clib_memcpy (exceptfds, ldp->libc_ex_bitmap,
+ vec_len (ldp->ex_bitmap) * sizeof (clib_bitmap_t));
tspec.tv_sec = tspec.tv_nsec = 0;
rv = libc_pselect (libc_bits,
readfds ? readfds : NULL,
goto done;
}
}
- while ((time_out == -1) || (clib_time_now (&vcom->clib_time) < time_out));
+ while ((time_out == -1) || (clib_time_now (&ldp->clib_time) < time_out));
rv = 0;
done:
/* TBD: set timeout to amount of time left */
- vec_reset_length (vcom->rd_bitmap);
- vec_reset_length (vcom->sid_rd_bitmap);
- vec_reset_length (vcom->libc_rd_bitmap);
- vec_reset_length (vcom->wr_bitmap);
- vec_reset_length (vcom->sid_wr_bitmap);
- vec_reset_length (vcom->libc_wr_bitmap);
- vec_reset_length (vcom->ex_bitmap);
- vec_reset_length (vcom->sid_ex_bitmap);
- vec_reset_length (vcom->libc_ex_bitmap);
-
- if (VCOM_DEBUG > 3)
+ vec_reset_length (ldp->rd_bitmap);
+ vec_reset_length (ldp->sid_rd_bitmap);
+ vec_reset_length (ldp->libc_rd_bitmap);
+ vec_reset_length (ldp->wr_bitmap);
+ vec_reset_length (ldp->sid_wr_bitmap);
+ vec_reset_length (ldp->libc_wr_bitmap);
+ vec_reset_length (ldp->ex_bitmap);
+ vec_reset_length (ldp->sid_ex_bitmap);
+ vec_reset_length (ldp->libc_ex_bitmap);
+
+ if (LDP_DEBUG > 3)
{
if (rv < 0)
{
tspec.tv_sec = timeout->tv_sec;
tspec.tv_nsec = timeout->tv_usec * 1000;
}
- return vcom_pselect (nfds, readfds, writefds, exceptfds,
- timeout ? &tspec : NULL, NULL);
+ return ldp_pselect (nfds, readfds, writefds, exceptfds,
+ timeout ? &tspec : NULL, NULL);
}
#ifdef __USE_XOPEN2K
const struct timespec *__restrict timeout,
const __sigset_t * __restrict sigmask)
{
- return vcom_pselect (nfds, readfds, writefds, exceptfds, timeout, 0);
+ return ldp_pselect (nfds, readfds, writefds, exceptfds, timeout, 0);
}
#endif
u8 is_nonblocking = type & SOCK_NONBLOCK ? 1 : 0;
int sock_type = type & ~(SOCK_CLOEXEC | SOCK_NONBLOCK);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (((domain == AF_INET) || (domain == AF_INET6)) &&
func_str = "vppcom_session_create";
- if (VCOM_DEBUG > 0)
+ if (LDP_DEBUG > 0)
clib_warning ("LDP<%d>: : calling %s(): "
"proto %u (%s), is_nonblocking %u",
getpid (), func_str, proto,
}
else
{
- func_str = "vcom_fd_from_sid";
- rv = vcom_fd_from_sid (sid);
+ func_str = "ldp_fd_from_sid";
+ rv = ldp_fd_from_sid (sid);
if (rv < 0)
{
(void) vppcom_session_close (sid);
{
func_str = "libc_socket";
- if (VCOM_DEBUG > 0)
+ if (LDP_DEBUG > 0)
clib_warning ("LDP<%d>: : calling %s()", getpid (), func_str);
rv = libc_socket (domain, type, protocol);
}
- if (VCOM_DEBUG > 0)
+ if (LDP_DEBUG > 0)
{
if (rv < 0)
{
int rv;
int sock_type = type & ~(SOCK_CLOEXEC | SOCK_NONBLOCK);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (((domain == AF_INET) || (domain == AF_INET6)) &&
{
func_str = "libc_socket";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: : calling %s()", getpid (), func_str);
rv = libc_socket (domain, type, protocol);
}
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
{
if (rv < 0)
{
{
int rv;
const char *func_str;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
rv = -1;
goto done;
}
- if (VCOM_DEBUG > 0)
+ if (LDP_DEBUG > 0)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): sid %u (0x%x), "
"addr %p, len %u",
getpid (), fd, fd, func_str, sid, sid, addr, len);
{
func_str = "libc_bind";
- if (VCOM_DEBUG > 0)
+ if (LDP_DEBUG > 0)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"addr %p, len %u",
getpid (), fd, fd, func_str, addr, len);
}
done:
- if (VCOM_DEBUG > 0)
+ if (LDP_DEBUG > 0)
{
if (rv < 0)
{
}
static inline int
-vcom_copy_ep_to_sockaddr (__SOCKADDR_ARG addr, socklen_t * __restrict len,
- vppcom_endpt_t * ep)
+ldp_copy_ep_to_sockaddr (__SOCKADDR_ARG addr, socklen_t * __restrict len,
+ vppcom_endpt_t * ep)
{
int rv = 0;
int sa_len, copy_len;
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (addr && len && ep)
{
int rv;
const char *func_str;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
ep.ip = addr_buf;
func_str = "vppcom_session_attr[GET_LCL_ADDR]";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): sid %u (0x%x), "
"addr %p, len %u",
getpid (), fd, fd, func_str, sid, sid, addr, len);
}
else
{
- rv = vcom_copy_ep_to_sockaddr (addr, len, &ep);
+ rv = ldp_copy_ep_to_sockaddr (addr, len, &ep);
if (rv != VPPCOM_OK)
{
errno = -rv;
{
func_str = "libc_getsockname";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"addr %p, len %u",
getpid (), fd, fd, func_str, addr, len);
rv = libc_getsockname (fd, addr, len);
}
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
{
if (rv < 0)
{
{
int rv;
const char *func_str = __func__;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (!addr)
rv = -1;
goto done;
}
- if (VCOM_DEBUG > 0)
+ if (LDP_DEBUG > 0)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): sid %u (0x%x) "
"addr %p len %u",
getpid (), fd, fd, func_str, sid, sid, addr, len);
{
func_str = "libc_connect";
- if (VCOM_DEBUG > 0)
+ if (LDP_DEBUG > 0)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"addr %p, len %u",
getpid (), fd, fd, func_str, addr, len);
}
done:
- if (VCOM_DEBUG > 0)
+ if (LDP_DEBUG > 0)
{
if (rv < 0)
{
{
int rv;
const char *func_str;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
ep.ip = addr_buf;
func_str = "vppcom_session_attr[GET_PEER_ADDR]";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): sid %u (0x%x), "
"addr %p, len %u",
getpid (), fd, fd, func_str, sid, sid, addr, len);
}
else
{
- rv = vcom_copy_ep_to_sockaddr (addr, len, &ep);
+ rv = ldp_copy_ep_to_sockaddr (addr, len, &ep);
if (rv != VPPCOM_OK)
{
errno = -rv;
{
func_str = "libc_getpeername";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"addr %p, len %u",
getpid (), fd, fd, func_str, addr, len);
rv = libc_getpeername (fd, addr, len);
}
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
{
if (rv < 0)
{
{
ssize_t size;
const char *func_str;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
func_str = "vppcom_session_sendto";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): sid %u (0x%x), "
"buf %p, n %u, flags 0x%x",
getpid (), fd, fd, func_str, sid, sid, buf, n, flags);
{
func_str = "libc_send";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"buf %p, n %u, flags 0x%x",
getpid (), fd, fd, func_str, buf, n, flags);
size = libc_send (fd, buf, n, flags);
}
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
{
if (size < 0)
{
{
ssize_t size = 0;
const char *func_str;
- u32 sid = vcom_sid_from_fd (out_fd);
+ u32 sid = ldp_sid_from_fd (out_fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
out_fd, out_fd, func_str, sid, sid, rv,
vppcom_retval_str (rv));
- vec_reset_length (vcom->io_buffer);
+ vec_reset_length (ldp->io_buffer);
errno = -rv;
size = -1;
goto done;
("LDP<%d>: ERROR: fd %d (0x%x): %s(): sid %u (0x%x), "
"returned %d (%s)!", getpid (), out_fd, out_fd, func_str,
sid, sid, size, vppcom_retval_str (size));
- vec_reset_length (vcom->io_buffer);
+ vec_reset_length (ldp->io_buffer);
errno = -size;
size = -1;
goto done;
}
bytes_to_read = size;
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning
("LDP<%d>: fd %d (0x%x): called %s(): sid %u (0x%x), "
"results %ld, n_bytes_left %lu, bytes_to_read %lu", getpid (),
{
if (!results)
{
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): sid %u (0x%x): "
"EAGAIN",
getpid (), out_fd, out_fd, sid, sid);
continue;
}
bytes_to_read = clib_min (n_bytes_left, bytes_to_read);
- vec_validate (vcom->io_buffer, bytes_to_read);
- nbytes = libc_read (in_fd, vcom->io_buffer, bytes_to_read);
+ vec_validate (ldp->io_buffer, bytes_to_read);
+ nbytes = libc_read (in_fd, ldp->io_buffer, bytes_to_read);
if (nbytes < 0)
{
func_str = "libc_read";
clib_warning ("LDP<%d>: ERROR: fd %d (0x%x): %s(): in_fd (%d), "
"io_buffer %p, bytes_to_read %lu, rv %d, "
"errno %d", getpid (), out_fd, out_fd, func_str,
- in_fd, vcom->io_buffer, bytes_to_read, nbytes,
+ in_fd, ldp->io_buffer, bytes_to_read, nbytes,
errno_val);
errno = errno_val;
if (results == 0)
{
- vec_reset_length (vcom->io_buffer);
+ vec_reset_length (ldp->io_buffer);
size = -1;
goto done;
}
goto update_offset;
}
func_str = "vppcom_session_write";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning
("LDP<%d>: fd %d (0x%x): calling %s(): sid %u (0x%x), "
"buf %p, nbytes %u: results %d, n_bytes_left %d", getpid (),
- out_fd, out_fd, func_str, sid, sid, vcom->io_buffer, nbytes,
+ out_fd, out_fd, func_str, sid, sid, ldp->io_buffer, nbytes,
results, n_bytes_left);
- size = vppcom_session_write (sid, vcom->io_buffer, nbytes);
+ size = vppcom_session_write (sid, ldp->io_buffer, nbytes);
if (size < 0)
{
if (size == VPPCOM_EAGAIN)
{
if (!results)
{
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning
("LDP<%d>: fd %d (0x%x): sid %u (0x%x): "
"EAGAIN", getpid (), out_fd, out_fd, sid, sid);
"sid %u, io_buffer %p, nbytes %u "
"returned %d (%s)",
getpid (), out_fd, out_fd, func_str,
- sid, vcom->io_buffer, nbytes,
+ sid, ldp->io_buffer, nbytes,
size, vppcom_retval_str (size));
}
if (results == 0)
{
- vec_reset_length (vcom->io_buffer);
+ vec_reset_length (ldp->io_buffer);
errno = -size;
size = -1;
goto done;
while (n_bytes_left > 0);
update_offset:
- vec_reset_length (vcom->io_buffer);
+ vec_reset_length (ldp->io_buffer);
if (offset)
{
off_t off = lseek (in_fd, *offset, SEEK_SET);
{
func_str = "libc_send";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"in_fd %d, offset %p, len %u",
getpid (), out_fd, out_fd, func_str,
}
done:
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
{
if (size < 0)
{
{
ssize_t size;
const char *func_str;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
{
func_str = "vppcom_session_recvfrom";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x), buf %p, n %u, flags 0x%x", getpid (),
fd, fd, func_str, sid, sid, buf, n, flags);
{
func_str = "libc_recv";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"buf %p, n %u, flags 0x%x", getpid (),
fd, fd, func_str, buf, n, flags);
size = libc_recv (fd, buf, n, flags);
}
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
{
if (size < 0)
{
{
ssize_t size;
const char *func_str = __func__;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
func_str = "vppcom_session_sendto";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x), buf %p, n %u, flags 0x%x, ep %p",
getpid (), fd, fd, func_str, sid, sid, buf, n,
{
func_str = "libc_sendto";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"buf %p, n %u, flags 0x%x, addr %p, addr_len %d",
getpid (), fd, fd, func_str, buf, n, flags,
}
done:
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
{
if (size < 0)
{
{
ssize_t size;
const char *func_str;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
func_str = "vppcom_session_recvfrom";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x), buf %p, n %u, flags 0x%x, ep %p",
getpid (), fd, fd, func_str, sid, sid, buf, n,
size = vppcom_session_recvfrom (sid, buf, n, flags, &ep);
if (size > 0)
- size = vcom_copy_ep_to_sockaddr (addr, addr_len, &ep);
+ size = ldp_copy_ep_to_sockaddr (addr, addr_len, &ep);
}
else
size = vppcom_session_recvfrom (sid, buf, n, flags, NULL);
{
func_str = "libc_recvfrom";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"buf %p, n %u, flags 0x%x, addr %p, addr_len %d",
getpid (), fd, fd, func_str, buf, n, flags,
size = libc_recvfrom (fd, buf, n, flags, addr, addr_len);
}
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
{
if (size < 0)
{
{
ssize_t size;
const char *func_str;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
{
func_str = "libc_sendmsg";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"message %p, flags 0x%x",
getpid (), fd, fd, func_str, message, flags);
size = libc_sendmsg (fd, message, flags);
}
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
{
if (size < 0)
{
{
ssize_t size;
const char *func_str;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
{
func_str = "libc_sendmmsg";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"vmessages %p, vlen %u, flags 0x%x",
getpid (), fd, fd, func_str, vmessages, vlen, flags);
size = libc_sendmmsg (fd, vmessages, vlen, flags);
}
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
{
if (size < 0)
{
{
ssize_t size;
const char *func_str;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
{
func_str = "libc_recvmsg";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"message %p, flags 0x%x",
getpid (), fd, fd, func_str, message, flags);
size = libc_recvmsg (fd, message, flags);
}
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
{
if (size < 0)
{
{
ssize_t size;
const char *func_str;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
{
func_str = "libc_recvmmsg";
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"vmessages %p, vlen %u, flags 0x%x, tmo %p",
getpid (), fd, fd, func_str, vmessages, vlen,
size = libc_recvmmsg (fd, vmessages, vlen, flags, tmo);
}
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
{
if (size < 0)
{
{
int rv;
const char *func_str = __func__;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
u32 buflen = optlen ? (u32) * optlen : 0;
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
{
case TCP_NODELAY:
func_str = "vppcom_session_attr[SOL_TCP,GET_TCP_NODELAY]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x)",
getpid (), fd, fd, func_str, sid, sid);
break;
case TCP_MAXSEG:
func_str = "vppcom_session_attr[SOL_TCP,GET_TCP_USER_MSS]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x)",
getpid (), fd, fd, func_str, sid, sid);
break;
case TCP_KEEPIDLE:
func_str = "vppcom_session_attr[SOL_TCP,GET_TCP_KEEPIDLE]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x)",
getpid (), fd, fd, func_str, sid, sid);
break;
case TCP_KEEPINTVL:
func_str = "vppcom_session_attr[SOL_TCP,GET_TCP_KEEPINTVL]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x), SOL_TCP",
getpid (), fd, fd, func_str, sid, sid);
case TCP_INFO:
if (optval && optlen && (*optlen == sizeof (struct tcp_info)))
{
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): sid %u (0x%x), "
"SOL_TCP, TCP_INFO, optval %p, "
"optlen %d: #LDP-NOP#",
rv = -EFAULT;
break;
default:
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: ERROR: fd %d (0x%x): %s(): "
"sid %u (0x%x), SOL_TCP, "
"optname %d unsupported!",
{
case IPV6_V6ONLY:
func_str = "vppcom_session_attr[SOL_IPV6,GET_V6ONLY]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x)",
getpid (), fd, fd, func_str, sid, sid);
optval, optlen);
break;
default:
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: ERROR: fd %d (0x%x): %s(): "
"sid %u (0x%x), SOL_IPV6, "
"optname %d unsupported!",
{
case SO_ACCEPTCONN:
func_str = "vppcom_session_attr[SOL_SOCKET,GET_ACCEPTCONN]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x)",
getpid (), fd, fd, func_str, sid, sid);
break;
case SO_KEEPALIVE:
func_str = "vppcom_session_attr[SOL_SOCKET,GET_KEEPALIVE]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x)",
getpid (), fd, fd, func_str, sid, sid);
break;
case SO_PROTOCOL:
func_str = "vppcom_session_attr[SOL_SOCKET,GET_PROTOCOL]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x)",
getpid (), fd, fd, func_str, sid, sid);
break;
case SO_SNDBUF:
func_str = "vppcom_session_attr[SOL_SOCKET,GET_TX_FIFO_LEN]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x), optlen %d",
getpid (), fd, fd, func_str, sid, sid, buflen);
break;
case SO_RCVBUF:
func_str = "vppcom_session_attr[SOL_SOCKET,GET_RX_FIFO_LEN]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x), optlen %d",
getpid (), fd, fd, func_str, sid, sid, buflen);
break;
case SO_REUSEADDR:
func_str = "vppcom_session_attr[SOL_SOCKET,GET_REUSEADDR]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x)",
getpid (), fd, fd, func_str, sid, sid);
break;
case SO_BROADCAST:
func_str = "vppcom_session_attr[SOL_SOCKET,GET_BROADCAST]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x)",
getpid (), fd, fd, func_str, sid, sid);
break;
case SO_ERROR:
func_str = "vppcom_session_attr[SOL_SOCKET,GET_ERROR]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x)",
getpid (), fd, fd, func_str, sid, sid);
optval, optlen);
break;
default:
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: ERROR: fd %d (0x%x): %s(): "
"sid %u (0x%x), SOL_SOCKET, "
"optname %d unsupported!",
{
func_str = "libc_getsockopt";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): level %d, "
"optname %d, optval %p, optlen %d",
getpid (), fd, fd, func_str, level, optname,
rv = libc_getsockopt (fd, level, optname, optval, optlen);
}
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
{
if (rv < 0)
{
{
int rv;
const char *func_str = __func__;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
{
case TCP_NODELAY:
func_str = "vppcom_session_attr[SOL_TCP,SET_TCP_NODELAY]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x)",
getpid (), fd, fd, func_str, sid, sid);
break;
case TCP_MAXSEG:
func_str = "vppcom_session_attr[SOL_TCP,SET_TCP_USER_MSS]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x)",
getpid (), fd, fd, func_str, sid, sid);
break;
case TCP_KEEPIDLE:
func_str = "vppcom_session_attr[SOL_TCP,SET_TCP_KEEPIDLE]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x)",
getpid (), fd, fd, func_str, sid, sid);
break;
case TCP_KEEPINTVL:
func_str = "vppcom_session_attr[SOL_TCP,SET_TCP_KEEPINTVL]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x), SOL_TCP",
getpid (), fd, fd, func_str, sid, sid);
(void *) optval, &optlen);
break;
default:
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: ERROR: fd %d (0x%x): %s(): "
"sid %u (0x%x), SOL_TCP, "
"optname %d unsupported!",
{
case IPV6_V6ONLY:
func_str = "vppcom_session_attr[SOL_IPV6,SET_V6ONLY]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x)",
getpid (), fd, fd, func_str, sid, sid);
(void *) optval, &optlen);
break;
default:
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: ERROR: fd %d (0x%x): %s(): "
"sid %u (0x%x), SOL_IPV6, "
"optname %d unsupported!",
{
case SO_KEEPALIVE:
func_str = "vppcom_session_attr[SOL_SOCKET,SET_KEEPALIVE]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x)",
getpid (), fd, fd, func_str, sid, sid);
break;
case SO_REUSEADDR:
func_str = "vppcom_session_attr[SOL_SOCKET,SET_REUSEADDR]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x)",
getpid (), fd, fd, func_str, sid, sid);
break;
case SO_BROADCAST:
func_str = "vppcom_session_attr[SOL_SOCKET,SET_BROADCAST]";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): "
"sid %u (0x%x)",
getpid (), fd, fd, func_str, sid, sid);
(void *) optval, &optlen);
break;
default:
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: ERROR: fd %d (0x%x): %s(): "
"sid %u (0x%x), SOL_SOCKET, "
"optname %d unsupported!",
{
func_str = "libc_setsockopt";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): level %d, "
"optname %d, optval %p, optlen %d",
getpid (), fd, fd, func_str, level, optname,
rv = libc_setsockopt (fd, level, optname, optval, optlen);
}
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
{
if (rv < 0)
{
{
int rv;
const char *func_str;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
{
func_str = "vppcom_session_listen";
- if (VCOM_DEBUG > 0)
+ if (LDP_DEBUG > 0)
clib_warning
("LDP<%d>: fd %d (0x%x): calling %s(): sid %u (0x%x), n %d",
getpid (), fd, fd, func_str, sid, sid, n);
{
func_str = "libc_listen";
- if (VCOM_DEBUG > 0)
+ if (LDP_DEBUG > 0)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): n %d",
getpid (), fd, fd, func_str, n);
rv = libc_listen (fd, n);
}
- if (VCOM_DEBUG > 0)
+ if (LDP_DEBUG > 0)
{
if (rv < 0)
{
}
static inline int
-vcom_accept4 (int listen_fd, __SOCKADDR_ARG addr,
- socklen_t * __restrict addr_len, int flags)
+ldp_accept4 (int listen_fd, __SOCKADDR_ARG addr,
+ socklen_t * __restrict addr_len, int flags)
{
int rv;
const char *func_str;
- u32 listen_sid = vcom_sid_from_fd (listen_fd);
+ u32 listen_sid = ldp_sid_from_fd (listen_fd);
int accept_sid;
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (listen_sid != INVALID_SESSION_ID)
func_str = "vppcom_session_accept";
- if (VCOM_DEBUG > 0)
+ if (LDP_DEBUG > 0)
clib_warning ("LDP<%d>: listen fd %d (0x%x): calling %s(): "
"listen sid %u (0x%x), ep %p, flags 0x%x",
getpid (), listen_fd, listen_fd, func_str,
}
else
{
- rv = vcom_copy_ep_to_sockaddr (addr, addr_len, &ep);
+ rv = ldp_copy_ep_to_sockaddr (addr, addr_len, &ep);
if (rv != VPPCOM_OK)
{
(void) vppcom_session_close ((u32) accept_sid);
}
else
{
- func_str = "vcom_fd_from_sid";
- if (VCOM_DEBUG > 0)
+ func_str = "ldp_fd_from_sid";
+ if (LDP_DEBUG > 0)
clib_warning ("LDP<%d>: listen fd %d (0x%x): calling %s(): "
"accept sid %u (0x%x), ep %p, flags 0x%x",
getpid (), listen_fd, listen_fd,
func_str, accept_sid, accept_sid, ep, flags);
- rv = vcom_fd_from_sid ((u32) accept_sid);
+ rv = ldp_fd_from_sid ((u32) accept_sid);
if (rv < 0)
{
(void) vppcom_session_close ((u32) accept_sid);
{
func_str = "libc_accept4";
- if (VCOM_DEBUG > 0)
+ if (LDP_DEBUG > 0)
clib_warning ("LDP<%d>: listen fd %d (0x%x): calling %s(): "
"addr %p, addr_len %p, flags 0x%x",
getpid (), listen_fd, listen_fd, func_str,
rv = libc_accept4 (listen_fd, addr, addr_len, flags);
}
- if (VCOM_DEBUG > 0)
+ if (LDP_DEBUG > 0)
{
if (rv < 0)
{
accept4 (int fd, __SOCKADDR_ARG addr, socklen_t * __restrict addr_len,
int flags)
{
- return vcom_accept4 (fd, addr, addr_len, flags);
+ return ldp_accept4 (fd, addr, addr_len, flags);
}
int
accept (int fd, __SOCKADDR_ARG addr, socklen_t * __restrict addr_len)
{
- return vcom_accept4 (fd, addr, addr_len, 0);
+ return ldp_accept4 (fd, addr, addr_len, 0);
}
int
{
int rv;
const char *func_str;
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (sid != INVALID_SESSION_ID)
{
func_str = "libc_shutdown";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: fd %d (0x%x): calling %s(): how %d",
getpid (), fd, fd, func_str, how);
rv = libc_shutdown (fd, how);
}
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
{
if (rv < 0)
{
const char *func_str;
int rv;
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
func_str = "vppcom_epoll_create";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: calling %s()", getpid (), func_str);
rv = vppcom_epoll_create ();
rv = -1;
}
else
- rv = vcom_fd_from_sid ((u32) rv);
+ rv = ldp_fd_from_sid ((u32) rv);
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
{
if (rv < 0)
{
{
int rv;
const char *func_str;
- u32 vep_idx = vcom_sid_from_fd (epfd);
+ u32 vep_idx = ldp_sid_from_fd (epfd);
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (vep_idx != INVALID_SESSION_ID)
{
- u32 sid = vcom_sid_from_fd (fd);
+ u32 sid = ldp_sid_from_fd (fd);
if (sid != INVALID_SESSION_ID)
{
func_str = "vppcom_epoll_create";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: epfd %d (0x%x): calling %s(): "
"vep_idx %d (0x%x), op %d, sid %u (0x%x), event %p",
getpid (), epfd, epfd, func_str, vep_idx, vep_idx,
{
func_str = "libc_epoll_create1";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: calling %s(): EPOLL_CLOEXEC",
getpid (), func_str);
{
func_str = "libc_epoll_ctl";
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
clib_warning ("LDP<%d>: epfd %d (0x%x): calling %s(): "
"op %d, fd %d (0x%x), event %p",
getpid (), epfd, epfd, func_str, op, fd, fd, event);
}
done:
- if (VCOM_DEBUG > 1)
+ if (LDP_DEBUG > 1)
{
if (rv < 0)
{
}
static inline int
-vcom_epoll_pwait (int epfd, struct epoll_event *events,
- int maxevents, int timeout, const sigset_t * sigmask)
+ldp_epoll_pwait (int epfd, struct epoll_event *events,
+ int maxevents, int timeout, const sigset_t * sigmask)
{
const char *func_str;
int rv = 0;
double time_to_wait = (double) 0;
double time_out, now = 0;
- u32 vep_idx = vcom_sid_from_fd (epfd);
+ u32 vep_idx = ldp_sid_from_fd (epfd);
int libc_epfd;
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
if (PREDICT_FALSE (!events || (timeout < -1)))
}
time_to_wait = ((timeout >= 0) ? (double) timeout / (double) 1000 : 0);
- time_out = clib_time_now (&vcom->clib_time) + time_to_wait;
+ time_out = clib_time_now (&ldp->clib_time) + time_to_wait;
func_str = "vppcom_session_attr[GET_LIBC_EPFD]";
libc_epfd = vppcom_session_attr (vep_idx, VPPCOM_ATTR_GET_LIBC_EPFD, 0, 0);
goto done;
}
- if (VCOM_DEBUG > 2)
+ if (LDP_DEBUG > 2)
clib_warning ("LDP<%d>: epfd %d (0x%x): vep_idx %d (0x%x), "
"libc_epfd %d (0x%x), events %p, maxevents %d, "
"timeout %d, sigmask %p", getpid (), epfd, epfd,
maxevents, timeout, sigmask);
do
{
- if (!vcom->epoll_wait_vcl)
+ if (!ldp->epoll_wait_vcl)
{
func_str = "vppcom_epoll_wait";
- if (VCOM_DEBUG > 3)
+ if (LDP_DEBUG > 3)
clib_warning ("LDP<%d>: epfd %d (0x%x): calling %s(): "
"vep_idx %d (0x%x), events %p, maxevents %d",
getpid (), epfd, epfd, func_str,
rv = vppcom_epoll_wait (vep_idx, events, maxevents, 0);
if (rv > 0)
{
- vcom->epoll_wait_vcl = 1;
+ ldp->epoll_wait_vcl = 1;
goto done;
}
else if (rv < 0)
}
}
else
- vcom->epoll_wait_vcl = 0;
+ ldp->epoll_wait_vcl = 0;
if (libc_epfd > 0)
{
func_str = "libc_epoll_pwait";
- if (VCOM_DEBUG > 3)
+ if (LDP_DEBUG > 3)
clib_warning ("LDP<%d>: epfd %d (0x%x): calling %s(): "
"libc_epfd %d (0x%x), events %p, "
"maxevents %d, sigmask %p",
}
if (timeout != -1)
- now = clib_time_now (&vcom->clib_time);
+ now = clib_time_now (&ldp->clib_time);
}
while (now < time_out);
done:
- if (VCOM_DEBUG > 3)
+ if (LDP_DEBUG > 3)
{
if (libc_epfd > 0)
epfd = libc_epfd;
epoll_pwait (int epfd, struct epoll_event *events,
int maxevents, int timeout, const sigset_t * sigmask)
{
- return vcom_epoll_pwait (epfd, events, maxevents, timeout, sigmask);
+ return ldp_epoll_pwait (epfd, events, maxevents, timeout, sigmask);
}
int
epoll_wait (int epfd, struct epoll_event *events, int maxevents, int timeout)
{
- return vcom_epoll_pwait (epfd, events, maxevents, timeout, NULL);
+ return ldp_epoll_pwait (epfd, events, maxevents, timeout, NULL);
}
int
vcl_poll_t *vp;
double wait_for_time;
- if (VCOM_DEBUG > 3)
+ if (LDP_DEBUG > 3)
clib_warning ("LDP<%d>: fds %p, nfds %d, timeout %d",
getpid (), fds, nfds, timeout);
{
if (fds[i].fd >= 0)
{
- if (VCOM_DEBUG > 3)
+ if (LDP_DEBUG > 3)
clib_warning ("LDP<%d>: fds[%d].fd %d (0x%0x), .events = 0x%x, "
".revents = 0x%x", getpid (), i, fds[i].fd,
fds[i].fd, fds[i].events, fds[i].revents);
- sid = vcom_sid_from_fd (fds[i].fd);
+ sid = ldp_sid_from_fd (fds[i].fd);
if (sid != INVALID_SESSION_ID)
{
fds[i].fd = -fds[i].fd;
- vec_add2 (vcom->vcl_poll, vp, 1);
+ vec_add2 (ldp->vcl_poll, vp, 1);
vp->fds_ndx = i;
vp->sid = sid;
vp->events = fds[i].events;
n_revents = 0;
do
{
- if (vec_len (vcom->vcl_poll))
+ if (vec_len (ldp->vcl_poll))
{
func_str = "vppcom_poll";
- if (VCOM_DEBUG > 3)
+ if (LDP_DEBUG > 3)
clib_warning ("LDP<%d>: calling %s(): "
"vcl_poll %p, n_sids %u (0x%x): "
"n_libc_fds %u",
- getpid (), func_str, vcom->vcl_poll,
- vec_len (vcom->vcl_poll), vec_len (vcom->vcl_poll),
+ getpid (), func_str, ldp->vcl_poll,
+ vec_len (ldp->vcl_poll), vec_len (ldp->vcl_poll),
n_libc_fds);
- rv = vppcom_poll (vcom->vcl_poll, vec_len (vcom->vcl_poll), 0);
+ rv = vppcom_poll (ldp->vcl_poll, vec_len (ldp->vcl_poll), 0);
if (rv < 0)
{
errno = -rv;
{
func_str = "libc_poll";
- if (VCOM_DEBUG > 3)
+ if (LDP_DEBUG > 3)
clib_warning ("LDP<%d>: calling %s(): fds %p, nfds %u: n_sids %u",
- getpid (), fds, nfds, vec_len (vcom->vcl_poll));
+ getpid (), fds, nfds, vec_len (ldp->vcl_poll));
rv = libc_poll (fds, nfds, 0);
if (rv < 0)
}
}
while ((wait_for_time == -1) ||
- (clib_time_now (&vcom->clib_time) < wait_for_time));
+ (clib_time_now (&ldp->clib_time) < wait_for_time));
rv = 0;
done:
- vec_foreach (vp, vcom->vcl_poll)
+ vec_foreach (vp, ldp->vcl_poll)
{
fds[vp->fds_ndx].fd = -fds[vp->fds_ndx].fd;
#ifdef __USE_XOPEN2K
fds[vp->fds_ndx].revents |= POLLWRNORM;
#endif
}
- vec_reset_length (vcom->vcl_poll);
+ vec_reset_length (ldp->vcl_poll);
- if (VCOM_DEBUG > 3)
+ if (LDP_DEBUG > 3)
{
if (rv < 0)
{
{
clib_warning ("LDP<%d>: returning %d (0x%x): n_sids %u, "
"n_libc_fds %d", getpid (), rv, rv,
- vec_len (vcom->vcl_poll), n_libc_fds);
+ vec_len (ldp->vcl_poll), n_libc_fds);
for (i = 0; i < nfds; i++)
{
if (fds[i].fd >= 0)
{
- if (VCOM_DEBUG > 3)
+ if (LDP_DEBUG > 3)
clib_warning ("LDP<%d>: fds[%d].fd %d (0x%0x), "
".events = 0x%x, .revents = 0x%x",
getpid (), i, fds[i].fd, fds[i].fd,
ppoll (struct pollfd *fds, nfds_t nfds,
const struct timespec *timeout, const sigset_t * sigmask)
{
- if ((errno = -vcom_init ()))
+ if ((errno = -ldp_init ()))
return -1;
clib_warning ("LDP<%d>: LDP-TBD", getpid ());
}
#endif
-void CONSTRUCTOR_ATTRIBUTE vcom_constructor (void);
+void CONSTRUCTOR_ATTRIBUTE ldp_constructor (void);
-void DESTRUCTOR_ATTRIBUTE vcom_destructor (void);
+void DESTRUCTOR_ATTRIBUTE ldp_destructor (void);
/*
* This function is called when the library is loaded
*/
void
-vcom_constructor (void)
+ldp_constructor (void)
{
swrap_constructor ();
- if (vcom_init () != 0)
- fprintf (stderr, "\nLDP<%d>: ERROR: vcom_constructor: failed!\n",
+ if (ldp_init () != 0)
+ fprintf (stderr, "\nLDP<%d>: ERROR: ldp_constructor: failed!\n",
getpid ());
else
- clib_warning ("LDP<%d>: VCOM constructor: done!\n", getpid ());
+ clib_warning ("LDP<%d>: LDP constructor: done!\n", getpid ());
}
/*
* This function is called when the library is unloaded
*/
void
-vcom_destructor (void)
+ldp_destructor (void)
{
swrap_destructor ();
- if (vcom->init)
+ if (ldp->init)
{
vppcom_app_destroy ();
- vcom->init = 0;
+ ldp->init = 0;
}
/* Don't use clib_warning() here because that calls writev()
- * which will call vcom_init().
+ * which will call ldp_init().
*/
- printf ("%s:%d: LDP<%d>: VCOM destructor: done!\n",
+ printf ("%s:%d: LDP<%d>: LDP destructor: done!\n",
__func__, __LINE__, getpid ());
}