예제 #1
0
/**
 * Sends v4v message to stubdom.
 * @param[in] hs
 * @param[in] buf: message to send
 * @param[in] size: size of buf
 * @returns true if message sent successfully, false otherwise.
 */
static bool pt_v4v_send_message(ATAPIPTHelperState* hs, void *buf, size_t size)
{
    int ret;

    ret = v4v_sendto(hs->v4v_fd, buf, size, 0, &hs->remote_addr);

    if (ret != size) {
        return false;
    }

    return true;
}
예제 #2
0
파일: interposer.c 프로젝트: dozylynx/v4v
INTERPOSE (sendto, ssize_t, int sockfd, const void *buf, size_t len,
           int flags, const struct sockaddr * dest_addr, socklen_t addrlen)
{
  v4v_addr_t peer;

  CHECK_INTERPOSE (sendto);

  if (!is_our_fd (sockfd))
    return orig_sendto (sockfd, buf, len, flags, dest_addr, addrlen);

  if (dest_addr && v4v_map_sa_to_v4va (&peer, dest_addr, addrlen))
    return -EINVAL;

  return v4v_sendto (sockfd, buf, len, flags, dest_addr ? &peer : NULL);

}