projects
/
my-code
/
ivac.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed udp "addtess already used" thing + introduced nic device string (used later)
[my-code/ivac.git]
/
src
/
network.h
diff --git
a/src/network.h
b/src/network.h
index
25a9891
..
079cea3
100644
(file)
--- a/
src/network.h
+++ b/
src/network.h
@@
-17,6
+17,7
@@
/* defines */
#define MAX_CONNECTIONS 32
/* defines */
#define MAX_CONNECTIONS 32
+#define MAX_NIC_DEVICE 32
#define IP_DIGITS 16
#define C_IN_USE (1<<0)
#define IP_DIGITS 16
#define C_IN_USE (1<<0)
@@
-37,6
+38,8
@@
#define N_E_ACCEPT -7
#define N_E_MAXC -8
#define N_E_ACCEPT -7
#define N_E_MAXC -8
+#define N_UDP_WRONG_SENDER -9
+
#define MAX_LISTEN_QUEUE 32
/* net specific variables */
#define MAX_LISTEN_QUEUE 32
/* net specific variables */
@@
-49,13
+52,17
@@
typedef struct s_connection {
} t_connection;
typedef struct s_net {
} t_connection;
typedef struct s_net {
- int l_fd; /* listen file descriptor */
- in_port_t l_port;
+ int l_fd; /* fd for tcp conn */
+ int l_udp_fd; /* fd for udp data receive */
+ int s_udp_fd; /* fd for udp data send */
+ in_port_t l_port; /* tcp port */
+ int l_udp_port; /* udp listen port */
unsigned short cap;
/* limited connections by now -- replaced by list management later */
int c_count;
t_connection connection[MAX_CONNECTIONS];
unsigned int sendmask; /* 32 bits for maximum of 32 connections */
unsigned short cap;
/* limited connections by now -- replaced by list management later */
int c_count;
t_connection connection[MAX_CONNECTIONS];
unsigned int sendmask; /* 32 bits for maximum of 32 connections */
+ char nic[MAX_NIC_DEVICE];
} t_net;
/* function prototypes */
} t_net;
/* function prototypes */
@@
-72,5
+79,9
@@
int network_deselect(t_net *net,int channel);
int network_manage_incoming(t_net *net);
int network_send(int fd,unsigned char *data,int datasize);
int network_receive(int fd,unsigned char *data,int datasize);
int network_manage_incoming(t_net *net);
int network_send(int fd,unsigned char *data,int datasize);
int network_receive(int fd,unsigned char *data,int datasize);
+int network_udp_listen_init(t_net *net);
+int network_udp_receive(t_net *net,int channel, unsigned char *data,int count);
+int network_udp_send(t_net *net,int channel, unsigned char *data,int size);
+int network_udp_shutdown(t_net *net);
#endif
#endif