int main(int argc,char **argv) {
+ /* TESTING BY NOW */
-
- return 1;
+ t_ivac ivac;
+
+ /* set username (futur: read from config or entered later) */
+ strcpy(ivac.username,"hackbard");
+
+ /* set event timeout */
+ ivac.event.timeout.tv_sec=IVAC_S_SEC;
+ ivac.event.timeout.tv_usec=IVAC_S_USEC;
+
+ /* set listen port (futur: read from config or entered later) */
+ network_set_listen_port(&(ivac.net),IVAC_LISTEN_PORT);
+
+ /* event init */
+ event_init(&(ivac.event));
+
+ /* input init */
+ input_init(&(ivac.input));
+
+ /* network init */
+ network_init(&(ivac.net));
+
+ /* add listening port + stdin to (read) event system */
+ event_math(ivac.net.l_fd,&(ivac.event),READ,ADD);
+ event_math(0,&(ivac.event),READ,ADD);
+
+ /* start event system - callbacks used: ivac_event_cb + ivac_regular_cb */
+ event_start(&(ivac.event),(void *)&ivac,ivac_event_cb,ivac_regular_cb);
+
+ return SUCCESS;
+}
+
+int ivac_event_cb(t_event *event,void *ptr) {
+
+ t_ivac *ivac;
+ int channel;
+
+ ivac=(t_ivac *)ptr;
+
+ if(FD_ISSET(ivac->net.l_fd,&(event->rfds))) {
+ /* manage incoming + send info */
+ channel=network_manage_incoming(&(ivac->net));
+ event_math(ivac->net.connection[channel].fd,event,READ,ADD);
+ send_info(channel,&(ivac->net),ivac->username);
+ }
+
+ /* receive info */
+ for(channel=0;channel<MAX_CONNECTIONS;channel++)
+ if(ivac->net.connection[channel].status&C_ESTABL)
+ if(FD_ISSET(ivac->net.connection[channel].fd,&(event->rfds)))
+ receive_info(channel,&(ivac->net));
+
+ /* user interaction */
+ if(FD_ISSET(0,&(event->rfds))) input_get_char(ivac);
+
+ return SUCCESS;
+}
+
+int ivac_regular_cb(t_event *event,void *ptr) {
+
+ /* usual jobs like audio & video transmit ... */
+
+ return SUCCESS;
}