void periodicRefreshFunction(unsigned int timerID, void *parameter1, void *parameter2) { /* Display the primary path details by default when data arrive */ displayPathDetails = 1; chosenPath = sctp_getPrimary(associationID); ncurses_display_PathStatus(associationID); sctp_startTimer(deltaT/1000, (deltaT%1000)*1000, periodicRefreshFunction, NULL, NULL); }
void* communicationUpNotif(unsigned int assocID, int status, unsigned int noOfDestinations, unsigned short noOfInStreams, unsigned short noOfOutStreams, int associationSupportsPRSCTP, void* dummy) { /* SCTP_AssociationStatus assocStatus; */ int TimerID; initializecurses(); sprintf(statusInfo, " Association ID =%-8x: Communication up (%u paths)\n", assocID, noOfDestinations); waddstr(statusWin,statusInfo); wrefresh(statusWin); /* Set heartbeat sctp_getAssocStatus(assocID,&assocStatus); for (pathID=0; pathID < assocStatus.numberOfAddresses; pathID++){ if (sctp_changeHeartBeat(assocID,pathID,SCTP_HEARTBEAT_ON,10000)==0) sprintf(statusInfo ,"Successful in changing the heartbeat for pathID = %d\n",pathID); else sprintf(statusInfo ,"Error in changing the heartbeat for pathID = %d\n",pathID); waddstr(statusWin,statusInfo); wrefresh(statusWin); }*/ /* Modify RTO Max to 10 secs so that network status change occurs faster sctp_getAssocStatus(assocID, &assocStatus); assocStatus.rtoMax = 10000; if (sctp_setAssocStatus(assocID, &assocStatus)==0) { sctp_getAssocStatus(assocID, &assocStatus); if (assocStatus.rtoMax == 10000) { sprintf(statusInfo," Maximum Round Trip Timeout modified to %d (msecs)\n", assocStatus.rtoMax); waddstr(statusWin,statusInfo); wrefresh(statusWin); } } */ /* Start Timer */ if (periodicRefresh) { TimerID = sctp_startTimer(deltaT/1000, (deltaT%1000)*1000, &periodicRefreshFunction, NULL, NULL); sprintf(statusInfo," TimerID is %d\n",TimerID); waddstr(statusWin,statusInfo); wrefresh(statusWin); } /* Update the Monitor tool data structures */ UpdateMonitorToolStruct(noOfInStreams, noOfOutStreams); /* Display functions */ ncurses_display_AssocStatus(assocID); ncurses_display_PathStatus(assocID); return NULL; }
unsigned int SCTP_startTimer(unsigned int milliseconds, sctp_timerCallback timer_cb, void *param1, void *param2) { return sctp_startTimer(milliseconds/1000, (milliseconds%1000)*1000, timer_cb, param1, param2); }