summaryrefslogtreecommitdiff
path: root/minix/lib/libsys/sef_ping.c
blob: 54e9fb04dbeb9c8012b4858c22de55210efa8d3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "syslib.h"
#include <assert.h>
#include <minix/sysutil.h>

/* SEF Ping callbacks. */
static struct sef_ping_cbs {
    sef_cb_ping_reply_t                 sef_cb_ping_reply;
} sef_ping_cbs = {
    SEF_CB_PING_REPLY_DEFAULT
};

/* SEF Ping prototypes for sef_receive(). */
int do_sef_ping_request(message *m_ptr);

/* Debug. */
EXTERN char* sef_debug_header(void);

/*===========================================================================*
 *                            do_sef_ping_request             		     *
 *===========================================================================*/
int do_sef_ping_request(message *m_ptr)
{
/* Handle a SEF Ping request. */

  /* Debug. */
#if SEF_PING_DEBUG
  sef_ping_debug_begin();
  sef_ping_dprint("%s. Got a SEF Ping request! About to reply.\n", 
      sef_debug_header());
  sef_ping_debug_end();
#endif

  /* Let the callback code handle the request. */
  sef_ping_cbs.sef_cb_ping_reply(m_ptr->m_source);

  /* Return OK not to let anybody else intercept the request. */
  return(OK);
}

/*===========================================================================*
 *                          sef_setcb_ping_reply                             *
 *===========================================================================*/
void sef_setcb_ping_reply(sef_cb_ping_reply_t cb)
{
  assert(cb != NULL);
  sef_ping_cbs.sef_cb_ping_reply = cb;
}

/*===========================================================================*
 *      	           sef_cb_ping_reply_null                            *
 *===========================================================================*/
void sef_cb_ping_reply_null(endpoint_t UNUSED(source))
{
}

/*===========================================================================*
 *      	           sef_cb_ping_reply_pong                            *
 *===========================================================================*/
void sef_cb_ping_reply_pong(endpoint_t source)
{
  ipc_notify(source);
}