Monado OpenXR Runtime
r_hub.c File Reference

Main hub of the remote driver. More...

#include "r_internal.h"
#include "util/u_var.h"
#include "util/u_misc.h"
#include "util/u_debug.h"
#include "util/u_space_overseer.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
Include dependency graph for r_hub.c:

Macros

#define _BSD_SOURCE
 
#define __USE_MISC
 
#define R_SOCKET_FMT   "%i"
 
#define R_TRACE(R, ...)   U_LOG_IFL_T((R)->rc.log_level, __VA_ARGS__)
 
#define R_DEBUG(R, ...)   U_LOG_IFL_D((R)->rc.log_level, __VA_ARGS__)
 
#define R_INFO(R, ...)   U_LOG_IFL_I((R)->rc.log_level, __VA_ARGS__)
 
#define R_WARN(R, ...)   U_LOG_IFL_W((R)->rc.log_level, __VA_ARGS__)
 
#define R_ERROR(R, ...)   U_LOG_IFL_E((R)->rc.log_level, __VA_ARGS__)
 
#define RC_TRACE(RC, ...)   U_LOG_IFL_T((RC)->log_level, __VA_ARGS__)
 
#define RC_DEBUG(RC, ...)   U_LOG_IFL_D((RC)->log_level, __VA_ARGS__)
 
#define RC_INFO(RC, ...)   U_LOG_IFL_I((RC)->log_level, __VA_ARGS__)
 
#define RC_WARN(RC, ...)   U_LOG_IFL_W((RC)->log_level, __VA_ARGS__)
 
#define RC_ERROR(RC, ...)   U_LOG_IFL_E((RC)->log_level, __VA_ARGS__)
 

Functions

static void socket_close (r_socket_t id)
 
static r_socket_t socket_create (void)
 
static int socket_set_opt (r_socket_t id, int flag)
 
static ssize_t socket_read (r_socket_t id, void *ptr, size_t size, size_t current)
 
static ssize_t socket_write (r_socket_t id, void *ptr, size_t size, size_t current)
 
static r_socket_t setup_accept_fd (struct r_hub *r)
 
static bool wait_for_read_and_to_continue (struct r_hub *r, r_socket_t socket)
 
static r_socket_t do_accept (struct r_hub *r)
 
static ssize_t read_one (struct r_hub *r, struct r_remote_data *data)
 
static void * run_thread (void *ptr)
 
static xrt_result_t r_hub_system_devices_get_roles (struct xrt_system_devices *xsysd, struct xrt_system_roles *out_roles)
 
static void r_hub_system_devices_destroy (struct xrt_system_devices *xsysd)
 
xrt_result_t r_create_devices (uint16_t port, uint32_t view_count, struct xrt_session_event_sink *broadcast, struct xrt_system_devices **out_xsysd, struct xrt_space_overseer **out_xso)
 Creates the remote system devices. More...
 
r_socket_t r_remote_connection_init (struct r_remote_connection *rc, const char *ip_addr, uint16_t port)
 Initializes and connects the connection. More...
 
int r_remote_connection_read_one (struct r_remote_connection *rc, struct r_remote_data *data)
 
int r_remote_connection_write_one (struct r_remote_connection *rc, const struct r_remote_data *data)
 

Detailed Description

Main hub of the remote driver.

Author
Jakob Bornecrantz jakob.nosp@m.@col.nosp@m.labor.nosp@m.a.co.nosp@m.m