implemented network_{receive,send} & {receive,send}_info
[my-code/ivac.git] / src / inet.h
1 /* inet.h -- inet headers */
2
3 #ifndef INET_H
4 #define INET_H
5
6 /* includes */
7 #include "ivac.h"
8 #include <stdio.h>
9 #include <errno.h>
10 #include <string.h>
11 #include <sys/types.h>
12 #include <sys/socket.h>
13
14 /* net specific includes */
15 #include <netinet/in.h>
16
17 /* defines */
18 #define MAX_CONNECTIONS 32
19
20 #define IP_DIGITS 16
21 #define C_IN_USE (1<<0)
22 #define C_INFO_A (1<<1)
23 #define C_SOCKET (1<<2)
24 #define C_ESTABL (1<<3)
25 #define C_HANGUP (1<<4)
26
27 #define SEND_I_MAX 128
28 #define SEND_I_NAME 'n'
29 #define SEND_I_G_CAP 'g'
30 #define SEND_I_AV_CAP 'c'
31
32 /* net specific variables */
33 typedef s_connection {
34   int fd;
35   char name[CHAR_USERNAME];
36   char ip[IP_DIGITS];
37   in_port_t port;
38   unsigned char status;
39   unsigned char cap; /* general capabilities */
40   unsigned short avcap; /* audio/video capabilities */
41 } t_connection;
42
43 typedef s_net {
44   int l_fd; /* listen file descriptor */
45   in_port_t l_port;
46   unsigned char cap;
47   unsigned short avcap;
48   /* limited connections by now -- replaced by list management later */
49   int c_count;
50   t_connection connection[MAX_CONNECTIONS];
51   unsigned int sendmask; /* 32 bits for maximum of 32 connections */
52 } t_net;
53
54 #endif
55