#include "network.h"
int network_init(t_net *net,int outfd) {
-
- struct sockaddr_in addr;
- int true;
-
- dprintf(outfd,"[network] initializing network ...\n");
+
+ dprintf(net->outfd,"[network] initializing network api ...\n");
memset(net->connection,0,MAX_CONNECTIONS*sizeof(t_connection));
net->c_count=0;
net->sendmask=0;
net->outfd=outfd;
+ return N_SUCCESS;
+}
+
+int network_listen(t_net *net) {
+
+ struct sockaddr_in addr;
+ int true;
+
if((net->l_fd=socket(AF_INET,SOCK_STREAM,0))==-1) {
perror("[network] socket call");
return N_ERROR;
/* function prototypes */
int network_init(t_net *net,int outfd);
+int network_listen(t_net *net);
int network_shutdown(t_net *net);
int network_set_listen_port(t_net *net,in_port_t port);
int network_manage_connection(t_net *net);