/** * End of interfacing socketjinni with FINS core * */ void socket_udp(int domain, int type,int protocol,int sockfd,int fakeID,pid_t processid) { PRINT_DEBUG("socket_UDP CALL"); char clientName[200]; int index; int pipe_desc; int tester; /** TODO lock the pipe semaphore then open the pipe*/ insertjinniSocket(processid, sockfd,fakeID,type,protocol); PRINT_DEBUG(); sprintf(clientName,CLIENT_CHANNEL_RX,processid,fakeID); mkfifo(clientName,0777); pipe_desc = open(clientName,O_WRONLY); index = findjinniSocket(processid,sockfd); if (index < 0) { PRINT_DEBUG("incorrect index !! Crash"); exit(1); } PRINT_DEBUG("0000"); jinniSockets[index].jinniside_pipe_ds = pipe_desc; /** Now the client can proceed to next step after openning the pipe */ PRINT_DEBUG("0002"); sem_getvalue(jinniSockets[index].s, &tester); PRINT_DEBUG("tester = %d", tester); PRINT_DEBUG("0001"); sem_wait(jinniSockets[index].s); ack_write(pipe_desc,processid,sockfd); sem_post(jinniSockets[index].as); /** TODO unlock the semaphore */ sem_post(jinniSockets[index].s); PRINT_DEBUG("0003"); return; }
/** * End of interfacing socketjinni with FINS core * */ void socket_udp(int domain, int type, int protocol, unsigned long long uniqueSockID) { PRINT_DEBUG("socket_UDP CALL"); char clientName[200]; int index; int pipe_desc; int tester; /** TODO lock the pipe semaphore then open the pipe*/ insertjinniSocket(uniqueSockID, type, protocol); PRINT_DEBUG(); index = findjinniSocket(uniqueSockID); if (index < 0) { PRINT_DEBUG("incorrect index !! Crash"); return; } ack_send(uniqueSockID, socket_call); }