#pragma once
#include <unistd.h>

typedef ssize_t (*read_fun_ptr_t)(int fd, void* buf, size_t count);
typedef ssize_t (*write_fun_ptr_t)(int fd, const void* buf, size_t count);
typedef int (*accept_fun_ptr_t)(int sockfd, struct sockaddr* addr, socklen_t* addrlen);

namespace tinyrpc {

    ssize_t read_hook(int fd, void* buf, size_t count);
    ssize_t write_hook(int fd, const void* buf, size_t count);
     int accept_hook(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
    void enableHook();
    void disableHook();
};

extern "C" {
ssize_t read(int fd, void* buf, size_t count);
ssize_t write(int fd, const void* buf, size_t count);
}