Nilorea Library
C utilities for networking, threading, graphics
ex_network.h File Reference

Nilorea Library n_network api test. More...

#include <getopt.h>
#include <sys/time.h>
#include <sys/types.h>
#include "nilorea/n_common.h"
#include "nilorea/n_log.h"
#include <sys/wait.h>
#include "nilorea/n_network.h"
#include "nilorea/n_network_msg.h"
#include "nilorea/n_thread_pool.h"
+ Include dependency graph for ex_network.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define NETMSG_DATA   1
 type of data message More...
 

Functions

int get_net_datas (N_STR *str, N_STR **hostname, N_STR **data)
 decode data we got from network More...
 
void * manage_client (void *ptr)
 recv/send datas if any for the client More...
 
int send_net_datas (NETWORK *netw, N_STR *data)
 send data to specified network More...
 

Detailed Description

Nilorea Library n_network api test.

Author
Castagnier Mickael
Version
1.0
Date
26/05/2015

Definition in file ex_network.h.

Macro Definition Documentation

◆ NETMSG_DATA

#define NETMSG_DATA   1

type of data message

Definition at line 9 of file ex_network.h.

Function Documentation

◆ get_net_datas()

int get_net_datas ( N_STR str,
N_STR **  hostname,
N_STR **  data 
)

decode data we got from network

Parameters
strthe string to decode
hostnamedecoded hostname
datadecoded data
Returns
TRUE or FALSE
Examples
ex_network.c.

Definition at line 98 of file ex_network.h.

References __n_assert, delete_msg(), get_int_from_msg(), get_nstr_from_msg(), LOG_DEBUG, LOG_ERR, make_msg_from_str(), n_log, and NETMSG_DATA.

Referenced by manage_client().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ manage_client()

void * manage_client ( void *  ptr)

recv/send datas if any for the client

Parameters
ptrpointer to the client structure to manage
Returns
NULL
Examples
ex_network.c.

Definition at line 139 of file ex_network.h.

References free_nstr, get_net_datas(), LOG_ERR, LOG_NOTICE, n_log, NETMSG_DATA, netw_get_msg(), netw_get_state(), netw_msg_get_type(), netw_start_thr_engine(), netw_wait_close(), send_net_datas(), SOCKET, and u_sleep().

+ Here is the call graph for this function:

◆ send_net_datas()

int send_net_datas ( NETWORK netw,
N_STR data 
)

send data to specified network

Parameters
netwthe target network
datathe data to send
Returns
TRUE or FALSE
Examples
ex_network.c.

Definition at line 45 of file ex_network.h.

References __n_assert, add_int_to_msg(), add_nstrdup_to_msg(), add_nstrptr_to_msg(), create_msg(), delete_msg(), free_nstr, LOG_DEBUG, LOG_ERR, make_str_from_msg(), n_log, NETMSG_DATA, netw_add_msg(), and new_nstr().

Referenced by manage_client().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: