rename platform_socket.h to pika_socket.h

This commit is contained in:
lyon 2022-11-10 17:17:29 +08:00
parent 31bda65f87
commit b590df0979
6 changed files with 60 additions and 15 deletions

View File

@ -20,7 +20,7 @@
#include <stddef.h>
#include "pika_adapter_rtt.h"
/* depend on the socket module */
#include "../socket/platform_socket.h"
#include "../socket/pika_socket.h"
#define RT_USING_SAL 1

View File

@ -1,16 +1,5 @@
#include "_socket.h"
#include "_socket_socket.h"
#ifdef __linux__
#include <arpa/inet.h>
#include <unistd.h>
#else
/*
You need to create the __platform_socket.h for your platform.
For example:
You can #include "lwip/socket.h" in the __platform_socket.h
*/
#include "__platform_socket.h"
#endif
#include "pika_socket.h"
#if !PIKASCRIPT_VERSION_REQUIRE_MINIMUN(1, 10, 4)
#error "This library requires PikaScript version 1.10.4 or higher"

View File

@ -0,0 +1,28 @@
#include "PikaObj.h"
#ifdef __linux__
#include <arpa/inet.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netdb.h>
#else
/*
You need to create the __platform_socket.h for your platform.
For example:
You can #include "lwip/socket.h" in the __platform_socket.h
*/
#include "__platform_socket.h"
#endif
int __platform_socket(int __domain, int __type, int __protocol);
int __platform_bind(int __fd,
const struct sockaddr* __addr,
socklen_t __addr_len);
int __platform_listen(int __fd, int __n);
int __platform_accept(int __fd, struct sockaddr* __addr, socklen_t* __addr_len);
int __platform_connect(int __fd,
const struct sockaddr* __addr,
socklen_t __addr_len);
int __platform_send(int __fd, const void* __buf, size_t __n, int __flags);
int __platform_recv(int __fd, void* __buf, size_t __n, int __flags);
int __platform_close(int __fd);
int __platform_gethostname(char* __name, size_t __len);

View File

@ -20,7 +20,7 @@
#include <stddef.h>
#include "pika_adapter_rtt.h"
/* depend on the socket module */
#include "../socket/platform_socket.h"
#include "../socket/pika_socket.h"
#define RT_USING_SAL 1

View File

@ -1,5 +1,5 @@
#include "_socket_socket.h"
#include "platform_socket.h"
#include "pika_socket.h"
#if !PIKASCRIPT_VERSION_REQUIRE_MINIMUN(1, 10, 4)
#error "This library requires PikaScript version 1.10.4 or higher"

View File

@ -0,0 +1,28 @@
#include "PikaObj.h"
#ifdef __linux__
#include <arpa/inet.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netdb.h>
#else
/*
You need to create the __platform_socket.h for your platform.
For example:
You can #include "lwip/socket.h" in the __platform_socket.h
*/
#include "__platform_socket.h"
#endif
int __platform_socket(int __domain, int __type, int __protocol);
int __platform_bind(int __fd,
const struct sockaddr* __addr,
socklen_t __addr_len);
int __platform_listen(int __fd, int __n);
int __platform_accept(int __fd, struct sockaddr* __addr, socklen_t* __addr_len);
int __platform_connect(int __fd,
const struct sockaddr* __addr,
socklen_t __addr_len);
int __platform_send(int __fd, const void* __buf, size_t __n, int __flags);
int __platform_recv(int __fd, void* __buf, size_t __n, int __flags);
int __platform_close(int __fd);
int __platform_gethostname(char* __name, size_t __len);