#include "kre_network.h"
Functions | |
| void | kre_net_set_local (struct sockaddr_in *a, int port) |
| Set addres to 0.0.0.0 and port to port. | |
| void | kre_net_set_addr (struct sockaddr_in *a, u8 ip[], int port) |
| Set addres to ip and port. | |
| void | kre_net_sock_release (struct socket **s) |
| Check if not null and release socket. | |
| int | kre_net_sock_create (struct socket **s) |
| Creating ( alocating ) new socket. | |
| int | kre_net_sock_setopt_reuse (struct socket *s) |
| Set one of the socket options. | |
| int | kre_net_sock_bind (struct socket *s, struct sockaddr_in *a) |
| Binding addres structure with socket. | |
| int | kre_net_sock_listen (struct socket *s) |
| Turn on listening on socket. | |
| int | kre_net_sock_accept (struct socket *srv, struct socket **cli) |
| Accepting client TCP request. | |
| int | kre_net_connect (struct socket *s, struct sockaddr_in *a) |
| Connect to server with addres a using socket s. | |
| int | kre_net_sock_receive (struct socket *s, struct sockaddr_in *a, unsigned char *buf, int len) |
| Receive len bytes from client socket s. | |
| int | kre_net_sock_send (struct socket *s, struct sockaddr_in *a, unsigned char *buf, int len) |
| Sending data to client socket. | |
| int kre_net_connect | ( | struct socket * | s, | |
| struct sockaddr_in * | a | |||
| ) |
Connect to server with addres a using socket s.
| s | Socket | |
| a | Addres |
| void kre_net_set_addr | ( | struct sockaddr_in * | a, | |
| u8 | ip[], | |||
| int | port | |||
| ) |
Set addres to ip and port.
| a | Pointer to addres which we set. | |
| ip | IP addres to set. | |
| port | Port number to set. |
| void kre_net_set_local | ( | struct sockaddr_in * | a, | |
| int | port | |||
| ) |
Set addres to 0.0.0.0 and port to port.
| a | Addres to set. | |
| port | Port number. |
| int kre_net_sock_accept | ( | struct socket * | srv, | |
| struct socket ** | cli | |||
| ) |
Accepting client TCP request.
| srv | Pointer to server socket. | |
| cli | Pointer to pointer client socket. |
| int kre_net_sock_bind | ( | struct socket * | s, | |
| struct sockaddr_in * | a | |||
| ) |
Binding addres structure with socket.
| s | Socket to bind. | |
| a | Addres structure to bind. |
| int kre_net_sock_listen | ( | struct socket * | s | ) |
Turn on listening on socket.
| s | Socket which should listen. |
| int kre_net_sock_receive | ( | struct socket * | s, | |
| struct sockaddr_in * | a, | |||
| unsigned char * | buf, | |||
| int | len | |||
| ) |
Receive len bytes from client socket s.
| s | Client socket. | |
| a | Client addres. | |
| buf | Buffer to handle data from client. | |
| len | Max bytes to get from client. |
| int kre_net_sock_send | ( | struct socket * | s, | |
| struct sockaddr_in * | a, | |||
| unsigned char * | buf, | |||
| int | len | |||
| ) |
Sending data to client socket.
| s | Client socket. | |
| a | Cut addres to send to the client. | |
| buf | Data buffer which will be send to the client. | |
| len | Count of byte from data buffer which will be send to the client. |
| int kre_net_sock_setopt_reuse | ( | struct socket * | s | ) |
Set one of the socket options.
REUSEADDR = 1 this is not work and need recognition.
1.5.8