extern BOOL HTAlertCall_add (HTList * list, HTAlertCallback * cbf, HTAlertOpcode opcode);The
opcode
parameter signifies which call back function to call depending of the type
of the message. opcode
can be any combination of the bit-flags defined by
HTAlertOpcode
which is defined as
typedef enum _HTAlertOpcode { HT_PROG_DNS = 0x1, /* Doing DNS resolution */ HT_PROG_CONNECT = 0x2, /* Connecting Active */ HT_PROG_ACCEPT = 0x4, /* Connecting Passive */ HT_PROG_READ = 0x8, /* Read data */ HT_PROG_WRITE = 0x10, /* Write data */ HT_PROG_DONE = 0x20, /* Request finished */ HT_PROG_WAIT = 0x40, /* Wait for socket */ HT_A_PROGRESS = 0xFF, /* Send a progress report - no reply */ /* First word are reserved for progress notifications */ HT_A_MESSAGE = 0x1<<8, /* Send a message - no reply */ HT_A_CONFIRM = 0x2<<8, /* Want YES or NO back */ HT_A_PROMPT = 0x4<<8, /* Want full dialog */ HT_A_SECRET = 0x8<<8, /* Secret dialog (e.g. password) */ HT_A_USER_PW = 0x10<<8 /* Atomic userid and password */ } HTAlertOpcode;If you register one callback for
HT_A_PROGRESS
then this will get called on all
progress notifications. The callback functions are defined as a generic callback where the caller
can pass a set of input parameters and the callee can return a set of output parameters. The
callback function must be of the form:
typedef BOOL HTAlertCallback (HTRequest * request, HTAlertOpcode op, int msgnum, const char * dfault, void * input, HTAlertPar * reply);Likewise, a callback function can be removed from a list using the following function:
extern BOOL HTAlertCall_delete (HTList * list, HTAlertCallback * cbf);The Library provides sample implementations of all these Callback functions. Yon can find this in the Application Interface description