#ifndef RETRONFS95_RPC_HPP #define RETRONFS95_RPC_HPP #include "socket.hpp" #include "xdr.hpp" namespace retronfs { enum RpcAuthFlavor { AUTH_NONE = 0, AUTH_SYS = 1 }; struct RpcIdentity { std::string machine; uint32_t uid; uint32_t gid; std::vector groups; RpcIdentity() : machine("retronfs95"), uid(65534), gid(65534) {} }; class RpcClient { public: RpcClient(const std::string& host, unsigned short port, uint32_t program, uint32_t version); Bytes call(uint32_t procedure, const Bytes& args, const RpcIdentity& identity); private: std::string host_; unsigned short port_; uint32_t program_; uint32_t version_; uint32_t xid_; Bytes make_call(uint32_t procedure, const Bytes& args, const RpcIdentity& identity, uint32_t xid); Bytes read_record(TcpSocket& sock); }; } #endif