tfStopTreck

Jump to: navigation, search

Table of Contents >> Stopping the Treck Stack


#include <trsocket.h>


int tfStopTreck (
ttUserContext contextHandle
);
Conditional parameter. See details in Parameters below.


Parameters

  • contextHandle
    When multiple contexts are in use (TM_MULTIPLE_CONTEXT) this parameter allows the user to specify the context to stop by passing the context handle as returned by tfCreateTreckContext(). In single context mode this function is void.


Function Description

This function is used to stop and uninitialize the Treck protocol stack. This includes:

  • Freeing counting semaphores making sure that none is in use.
  • Closing all interfaces immediately, i.e. no PPP close down, no DHCPv6 close down, etcetera. Only the device driver close routine(s) will be called.
  • Closing/resetting all sockets
  • Killing/freeing all timers
  • Identifing permanently allocated memory (such as DHCP buffers, counting semaphores, select pend entries, interfaces, etc..) and freeing it.
  • Calling tfFreeDynamicMemory() to purge all recycled memory.
  • Making sure there is no more Treck stack allocated memory before freeing the context


Returns

  • TM_ENOERROR
    Success.
  • TM_EPERM
    Some counting semaphores are still in use. One or more user threads are pending.


Limitations

  • These functions cannot be called while a user function is pending in the Treck stack
  • The user should stop all the Treck servers (i.e. tfHttpdUserStop(), tfFtpdUserStop(), etc..) before calling this function.
  • The user should stop all the Treck clients (i.e. tfFtpFreeSession(), tfHttpcUserClose() etc..) before calling this function.
  • The user should guarantee that no Treck function will be called for that context.
  • If the user wants a clean close down of the interfaces, the user should close the interfaces first before calling this function.


Table of Contents >> Stopping the Treck Stack