2020-04-12 05:34:56 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <sys/un.h>
|
|
|
|
#include <sys/socket.h>
|
2021-01-12 00:07:48 -08:00
|
|
|
#include <string_view>
|
2021-10-19 23:46:38 -07:00
|
|
|
#include <string>
|
2021-08-19 04:36:47 -07:00
|
|
|
#include <vector>
|
2020-04-12 05:34:56 -07:00
|
|
|
|
2021-10-19 23:46:38 -07:00
|
|
|
struct sock_cred : public ucred {
|
|
|
|
std::string context;
|
|
|
|
};
|
|
|
|
|
2020-06-19 03:52:25 -07:00
|
|
|
socklen_t setup_sockaddr(sockaddr_un *sun, const char *name);
|
2021-10-19 23:46:38 -07:00
|
|
|
bool get_client_cred(int fd, sock_cred *cred);
|
2021-08-19 04:36:47 -07:00
|
|
|
std::vector<int> recv_fds(int sockfd);
|
2020-04-12 05:34:56 -07:00
|
|
|
int recv_fd(int sockfd);
|
2021-08-19 04:36:47 -07:00
|
|
|
int send_fds(int sockfd, const int *fds, int cnt);
|
|
|
|
int send_fd(int sockfd, int fd);
|
2020-04-12 05:34:56 -07:00
|
|
|
int read_int(int fd);
|
|
|
|
int read_int_be(int fd);
|
|
|
|
void write_int(int fd, int val);
|
|
|
|
void write_int_be(int fd, int val);
|
2021-01-12 00:07:48 -08:00
|
|
|
std::string read_string(int fd);
|
2022-04-03 13:09:23 +08:00
|
|
|
bool read_string(int fd, std::string &str);
|
2021-01-12 00:07:48 -08:00
|
|
|
void write_string(int fd, std::string_view str);
|