Changeset 1014:908ffbb81f60 in freeDiameter for include/freeDiameter/libfdcore.h
- Timestamp:
- Mar 29, 2013, 6:30:59 PM (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
include/freeDiameter/libfdcore.h
r1010 r1014 463 463 * PARAMETERS: 464 464 * pmsg : Location of the message to be sent on the network (set to NULL on function return to avoid double deletion). 465 * anscb : A callback to be called when answer is received, if msg is a request (optional for fd_msg_send) 466 * anscb_data : opaque data to be passed back to the anscb when it is called. 465 * anscb : A callback to be called when corresponding answer is received, when sending a request (not used with answers) 466 * anscb_data : opaque data to be passed back to the anscb (or expirecb) when it is called. 467 * expirecb : (only for fd_msg_send_timeout) If the request did not get an answer before timeout, this callback is called. 467 468 * timeout : (only for fd_msg_send_timeout) sets the absolute time until when to wait for an answer. Past this time, 468 * the anscb is called with the request as parameter and the answer will be discarded when received.469 * the expirecb is called with the request and the answer will be discarded if received later. 469 470 * 470 471 * DESCRIPTION: 471 472 * Sends a message on the network. (actually simply queues it in a global queue, to be picked by a daemon's thread) 472 473 * For requests, the end-to-end id must be set (see fd_msg_get_eteid / MSGFL_ALLOC_ETEID). 473 * For answers, the message must be created with function fd_msg_new_answ .474 * For answers, the message must be created with function fd_msg_new_answer_from_req. 474 475 * 475 476 * The routing module will handle sending to the correct peer, usually based on the Destination-Realm / Destination-Host AVP. … … 477 478 * If the msg is a request, there are two ways of receiving the answer: 478 479 * - either having registered a callback in the dispatch module (see fd_disp_register) 479 * - or provide a callback as parameterhere. If such callback is provided, it is called before the dispatch callbacks.480 * The prototype for this callback function is:480 * - or provide a anscb callback here. If such callback is provided, it is called before the dispatch callbacks. 481 * The prototype for this anscb callback function is: 481 482 * void anscb(void * data, struct msg ** answer) 482 483 * where: … … 489 490 * If no callback is registered to handle an answer, the message is discarded and an error is logged. 490 491 * 491 * fd_msg_send_timeout is similar to fd_msg_send, except that it takes an additional argument "timeout" and can be called 492 * only with requests as parameters, and an anscb callback. 493 * If the matching answer or error is received before the timeout date passes, everything occurs as with fd_msg_send. Otherwise, 494 * the request is removed from the queue (meaning the matching answer will be discarded upon reception) and passed to the answcb 495 * function. This function can easily distinguish between timeout case and answer case by checking if the message received is 496 * a request. Upon return, if the *msg parameter is not NULL, it is freed (not passed to other callbacks). 492 * fd_msg_send_timeout is similar to fd_msg_send, except that it takes two additional arguments "expirecb" and "timeout". 493 * If the message parameter is an answer, there is no difference with fd_msg_send. 494 * Otherwise, if the corresponding answer (or error) is received before the timeout date elapses, everything occurs as with fd_msg_send. 495 * Otherwise, the request is removed from the queue (meaning the matching answer will be discarded upon reception) and passed to the expirecb 496 * function. Upon return, if the *msg parameter is not NULL, it is freed (not passed to other callbacks). 497 * expirecb is called in a dedicated thread. 498 * 499 * The prototype for the expirecb callback function is: 500 * void expirecb(void * data, struct peer_hdr * sentto, struct msg ** request) 501 * where: 502 * data : opaque data that was registered along with the callback. 503 * sentto : pointer to the peer to which the message was sent and no answer received within timeout. 504 * request: location of the pointer to the request that was not answered. 497 505 * 498 506 * RETURN VALUE: … … 502 510 */ 503 511 int fd_msg_send ( struct msg ** pmsg, void (*anscb)(void *, struct msg **), void * data ); 504 int fd_msg_send_timeout ( struct msg ** pmsg, void (*anscb)(void *, struct msg **), void * data, const struct timespec *timeout );512 int fd_msg_send_timeout ( struct msg ** pmsg, void (*anscb)(void *, struct msg **), void * data, void (*expirecb)(void *, DiamId_t, size_t, struct msg **), const struct timespec *timeout ); 505 513 506 514 /*
Note: See TracChangeset
for help on using the changeset viewer.