int SCTP_unregisterInstance(unsigned short instance_name) { int result; if ((result = sctp_unregisterInstance(instance_name)) != 0) { fprintf(stderr, "sctp_unregisterInstance: an error occured.\n"); fflush(stderr); } return result; }
void shutdownCompleteNotif(unsigned int assocID, void* ulpDataPtr) { sprintf(statusInfo, " Association ID =%-8x: Shutdown complete\n", assocID); waddstr(statusWin,statusInfo); wrefresh(statusWin); endwin(); exit(0); /* delete the association, instance and terminate */ sctp_deleteAssociation(assocID); sctp_unregisterInstance(sctpInstance); exit(0); }
void communicationLostNotif(unsigned int assocID, unsigned short status, void* ulpDataPtr) { unsigned char buffer[SCTP_MAXIMUM_DATA_LENGTH]; unsigned int bufferLength; unsigned short streamID, streamSN; unsigned int protoID; unsigned int tsn; unsigned char flags; void* ctx; sprintf(statusInfo, " Association ID =%-8x: Communication lost (status %u)\n", assocID, status); waddstr(statusWin,statusInfo); wrefresh(statusWin); return; /* retrieve data */ bufferLength = sizeof(buffer); while (sctp_receiveUnsent(assocID, buffer, &bufferLength, &tsn, &streamID, &streamSN, &protoID, &flags, &ctx) >= 0) { /* do something with the retrieved data */ /* after that, reset bufferLength */ bufferLength = sizeof(buffer); } bufferLength = sizeof(buffer); while (sctp_receiveUnacked(assocID, buffer, &bufferLength, &tsn, &streamID, &streamSN, &protoID, &flags, &ctx) >= 0) { /* do something with the retrieved data */ /* after that, reset bufferLength */ bufferLength = sizeof(buffer); } /* delete the association, instace and terminate */ sctp_deleteAssociation(assocID); sctp_unregisterInstance(sctpInstance); exit(0); }