mirror of
https://github.com/vale981/ray
synced 2025-03-12 22:26:39 -04:00

* Add ability to pass callback context to object table lookup * Propagate errors during socket writes up to caller. * Use recv and MSG_WAITALL flag instead of looping read * Error checking in write_bytes * Method to listen on a network port * Revert "Use recv and MSG_WAITALL flag instead of looping read" This reverts commit 32d9333bc6a185729aadb4b41b70b3d7f150a9c2. * Some documentation * Clearer documentation * Fix bug where database clients were getting assigned the same ID * Regression test for unique client IDs
32 lines
802 B
C
32 lines
802 B
C
#ifndef IO_H
|
|
#define IO_H
|
|
|
|
#include <stdint.h>
|
|
|
|
enum common_message_type {
|
|
/** Disconnect a client. */
|
|
DISCONNECT_CLIENT,
|
|
/** Log a message from a client. */
|
|
LOG_MESSAGE,
|
|
/** Submit a task to the local scheduler. */
|
|
SUBMIT_TASK,
|
|
};
|
|
|
|
/* Helper functions for socket communication. */
|
|
|
|
int bind_inet_sock(const int port);
|
|
int bind_ipc_sock(const char *socket_pathname);
|
|
int connect_ipc_sock(const char *socket_pathname);
|
|
|
|
int accept_client(int socket_fd);
|
|
|
|
/* Reading and writing data */
|
|
|
|
int write_message(int fd, int64_t type, int64_t length, uint8_t *bytes);
|
|
void read_message(int fd, int64_t *type, int64_t *length, uint8_t **bytes);
|
|
|
|
void write_log_message(int fd, char *message);
|
|
void write_formatted_log_message(int fd, const char *format, ...);
|
|
char *read_log_message(int fd);
|
|
|
|
#endif
|