[go: up one dir, main page]

Menu

[897c37]: / modules / socket.lpc  Maximize  Restore  History

Download this file

125 lines (98 with data), 2.1 kB

#if 0
/*
 * LPC / C interface
 * 
 * Socket Library Interface
 *
 */
#endif

int handle;

reset()
{
    int x;

    handle = load_shared_object("socket.so");
}

query_destruct()
{
    unload_shared_object(handle);
}

int socket(int domain, int type, int protocol)
{
    return ext_c_call(handle, "lpc_socket", domain, type, protocol);
}

int ioctl(int socket, int ctl, string data)
{
    return ext_c_call(handle, "lpc_ioctl", socket, ctl, data);
}

int fcntl(int socket, int how int flag)
{
    return ext_c_call(handle, "lpc_fcntl", socket, how, flag);
}

int listen(int socket, int len)
{
    return ext_c_call(handle, "lpc_listen", socket, len);
}

int bind(int socket, string addr)
{
    return ext_c_call(handle, "lpc_bind", socket, addr);
}

string gethostbyname(string name)
{
    return ext_c_call(handle, "lpc_gethostbyname", name);
}

string gethostname()
{
    return ext_c_call(handle, "lpc_gethostname");
}

string gethostbyaddr(int addr)
{
    return ext_c_call(handle, "lpc_gethostbyaddr", addr);
}

int ntohl(int x)
{
    return ext_c_call(handle, "lpc_ntohl", x);
}

int htonl(int x)
{
    return ext_c_call(handle, "lpc_htonl", x);
}

int close(int fd)
{
    return ext_c_call(handle, "lpc_close", fd);
}

int shutdown(int fd, int how)
{
    return ext_c_call(handle, "lpc_shutdown", fd, how);
}

int connect(string address)
{
    return ext_c_call(handle, "lpc_connect", address);
}

send(int fd, string str, int flags)
{
    return ext_c_call(handle, "lpc_send", fd, str, flags);
}

sendto(int fd, string str, int flags)
{
    return ext_c_call(handle, "lpc_sendto", fd, str, flags);
}

string recv(int socket, int flags)
{
    return ext_c_call(handle, "lpc_recv", socket, flags);
}

string recvfrom(int socket, int flags)
{
    return ext_c_call(handle, "lpc_recvfrom", socket, flags);
}

setblocking(int socket)
{
    return ext_c_call(handle, "lpc_setblocking", socket);
}

string read(int fd, int max)
{
    return ext_c_call(handle, "lpc_read", fd, max);
}

write(int fd, string str)
{
    return ext_c_call(handle, "lpc_write", fd, str);

}