Minor tweak to callback function name for clarity (in code and documentation)

This commit is contained in:
Joseph Henry
2021-01-14 22:12:20 -08:00
parent 115a241807
commit f463d6c69f
12 changed files with 23 additions and 23 deletions

View File

@@ -66,7 +66,7 @@ At this stage, if a cryptographic identity for this node does not already exist
bool networkReady = false;
void myZeroTierEventCallback(struct zts_callback_msg *msg)
void on_zts_event(struct zts_callback_msg *msg)
{
if (msg->eventCode == ZTS_EVENT_NODE_ONLINE) {
printf("ZTS_EVENT_NODE_ONLINE, nodeId=%llx\n", msg->node->address);
@@ -77,7 +77,7 @@ void myZeroTierEventCallback(struct zts_callback_msg *msg)
int main()
{
zts_start("configPath", &myZeroTierEventCallback, 9994);
zts_start("configPath", &on_zts_event, 9994);
uint64_t nwid = 0x0123456789abcdef;
while (!networkReady) { sleep(1); }
zts_join(nwid);
@@ -138,7 +138,7 @@ struct zts_callback_msg
Here's an example of a callback function:
```
void myZeroTierEventCallback(struct zts_callback_msg *msg)
void on_zts_event(struct zts_callback_msg *msg)
{
if (msg->eventCode == ZTS_EVENT_NODE_ONLINE) {
printf("ZTS_EVENT_NODE_ONLINE, node=%llx\n", msg->node->address);

Binary file not shown.

View File

@@ -104,7 +104,7 @@ struct Node
to ensure timely receipt of future events. You should not call libzt API functions from
this function unless it's something trivial like zts_inet_ntop() or similar that has
no state-change implications. */
void myZeroTierEventCallback(void *msgPtr)
void on_zts_event(void *msgPtr)
{
struct zts_callback_msg *msg = (struct zts_callback_msg *)msgPtr;
@@ -233,7 +233,7 @@ int main(int argc, char **argv)
// If disabled: Settings will NOT be read from local.conf
zts_allow_local_conf(1);
if((err = zts_start(argv[1], &myZeroTierEventCallback, ztServicePort)) != ZTS_ERR_OK) {
if((err = zts_start(argv[1], &on_zts_event, ztServicePort)) != ZTS_ERR_OK) {
printf("Unable to start service, error = %d. Exiting.\n", err);
exit(1);
}

View File

@@ -22,7 +22,7 @@ struct Node
to ensure timely receipt of future events. You should not call libzt API functions from
this function unless it's something trivial like zts_inet_ntop() or similar that has
no state-change implications. */
void myZeroTierEventCallback(void *msgPtr)
void on_zts_event(void *msgPtr)
{
struct zts_callback_msg *msg = (struct zts_callback_msg *)msgPtr;
@@ -234,7 +234,7 @@ int main(int argc, char **argv)
// If disabled: Settings will NOT be read from local.conf
zts_allow_local_conf(1);
if((err = zts_start(argv[1], &myZeroTierEventCallback, ztServicePort)) != ZTS_ERR_OK) {
if((err = zts_start(argv[1], &on_zts_event, ztServicePort)) != ZTS_ERR_OK) {
printf("Unable to start service, error = %d. Exiting.\n", err);
exit(1);
}

View File

@@ -218,7 +218,7 @@ void printNetifDetails(const char *msgStr, struct zts_netif_details *d)
to ensure timely receipt of future events. You should not call libzt API functions from
this function unless it's something trivial like zts_inet_ntop() or similar that has
no state-change implications. */
void myZeroTierEventCallback(void *msgPtr)
void on_zts_event(void *msgPtr)
{
struct zts_callback_msg *msg = (struct zts_callback_msg *)msgPtr;
printf("eventCode=%d\n", msg->eventCode);
@@ -393,7 +393,7 @@ int main(int argc, char **argv)
// If disabled: Settings will NOT be read from local.conf
zts_allow_local_conf(1);
if((err = zts_start(configPath.c_str(), &myZeroTierEventCallback, ztServicePort)) != ZTS_ERR_OK) {
if((err = zts_start(configPath.c_str(), &on_zts_event, ztServicePort)) != ZTS_ERR_OK) {
printf("Unable to start service, error = %d. Exiting.\n", err);
exit(1);
}

View File

@@ -104,7 +104,7 @@ struct Node
to ensure timely receipt of future events. You should not call libzt API functions from
this function unless it's something trivial like zts_inet_ntop() or similar that has
no state-change implications. */
void myZeroTierEventCallback(void *msgPtr)
void on_zts_event(void *msgPtr)
{
struct zts_callback_msg *msg = (struct zts_callback_msg *)msgPtr;
@@ -189,7 +189,7 @@ int main(int argc, char **argv)
// If disabled: Settings will NOT be read from local.conf
zts_allow_local_conf(1);
if((err = zts_start(argv[1], &myZeroTierEventCallback, ztServicePort)) != ZTS_ERR_OK) {
if((err = zts_start(argv[1], &on_zts_event, ztServicePort)) != ZTS_ERR_OK) {
printf("Unable to start service, error = %d. Exiting.\n", err);
exit(1);
}

View File

@@ -104,7 +104,7 @@ struct Node
to ensure timely receipt of future events. You should not call libzt API functions from
this function unless it's something trivial like zts_inet_ntop() or similar that has
no state-change implications. */
void myZeroTierEventCallback(void *msgPtr)
void on_zts_event(void *msgPtr)
{
struct zts_callback_msg *msg = (struct zts_callback_msg *)msgPtr;
@@ -237,7 +237,7 @@ int main(int argc, char **argv)
// If disabled: Settings will NOT be read from local.conf
zts_allow_local_conf(1);
if((err = zts_start(argv[1], &myZeroTierEventCallback, ztServicePort)) != ZTS_ERR_OK) {
if((err = zts_start(argv[1], &on_zts_event, ztServicePort)) != ZTS_ERR_OK) {
printf("Unable to start service, error = %d. Exiting.\n", err);
exit(1);
}

View File

@@ -103,7 +103,7 @@ struct Node
to ensure timely receipt of future events. You should not call libzt API functions from
this function unless it's something trivial like zts_inet_ntop() or similar that has
no state-change implications. */
void myZeroTierEventCallback(void *msgPtr)
void on_zts_event(void *msgPtr)
{
struct zts_callback_msg *msg = (struct zts_callback_msg *)msgPtr;
@@ -236,7 +236,7 @@ int main(int argc, char **argv)
// If disabled: Settings will NOT be read from local.conf
zts_allow_local_conf(1);
if((err = zts_start(argv[1], &myZeroTierEventCallback, ztServicePort)) != ZTS_ERR_OK) {
if((err = zts_start(argv[1], &on_zts_event, ztServicePort)) != ZTS_ERR_OK) {
printf("Unable to start service, error = %d. Exiting.\n", err);
exit(1);
}

View File

@@ -22,7 +22,7 @@ struct Node
to ensure timely receipt of future events. You should not call libzt API functions from
this function unless it's something trivial like zts_inet_ntop() or similar that has
no state-change implications. */
void myZeroTierEventCallback(void *msgPtr)
void on_zts_event(void *msgPtr)
{
struct zts_callback_msg *msg = (struct zts_callback_msg *)msgPtr;
@@ -234,7 +234,7 @@ int main(int argc, char **argv)
// If disabled: Settings will NOT be read from local.conf
zts_allow_local_conf(1);
if((err = zts_start(argv[1], &myZeroTierEventCallback, ztServicePort)) != ZTS_ERR_OK) {
if((err = zts_start(argv[1], &on_zts_event, ztServicePort)) != ZTS_ERR_OK) {
printf("Unable to start service, error = %d. Exiting.\n", err);
exit(1);
}

View File

@@ -29,7 +29,7 @@ struct Node
to ensure timely receipt of future events. You should not call libzt API functions from
this function unless it's something trivial like zts_inet_ntop() or similar that has
no state-change implications. */
void myZeroTierEventCallback(void *msgPtr)
void on_zts_event(void *msgPtr)
{
struct zts_callback_msg *msg = (struct zts_callback_msg *)msgPtr;
@@ -239,7 +239,7 @@ public:
int err = ZTS_ERR_OK;
if((err = zts_start(configPath, &myZeroTierEventCallback, servicePort)) != ZTS_ERR_OK) {
if((err = zts_start(configPath, &on_zts_event, servicePort)) != ZTS_ERR_OK) {
printf("Unable to start service, error = %d.\n", err);
return err;
}

View File

@@ -101,7 +101,7 @@ bool nodeReady = false;
bool networkReady = false;
// Example callbacks
void myZeroTierEventCallback(struct zts_callback_msg *msg)
void on_zts_event(struct zts_callback_msg *msg)
{
// Node events
if (msg->eventCode == ZTS_EVENT_NODE_ONLINE) {
@@ -213,7 +213,7 @@ int main(int argc, char **argv)
// If disabled: Settings will NOT be read from local.conf
zts_allow_local_conf(1);
if((err = zts_start(argv[1], &myZeroTierEventCallback, ztServicePort)) != ZTS_ERR_OK) {
if((err = zts_start(argv[1], &on_zts_event, ztServicePort)) != ZTS_ERR_OK) {
NSLog(@"Unable to start service, error = %d. Exiting.\n", err);
exit(1);
}

View File

@@ -202,7 +202,7 @@ let printNetifDetails : @convention(c) (UnsafeMutableRawPointer?) -> Void =
var nodeReady:Bool = false
var networkReady:Bool = false
let myZeroTierEventCallback : @convention(c) (UnsafeMutableRawPointer?) -> Void =
let on_zts_event : @convention(c) (UnsafeMutableRawPointer?) -> Void =
{
(msgPtr) -> Void in
let msg = msgPtr?.bindMemory(to: zts_callback_msg.self, capacity: 1)
@@ -322,7 +322,7 @@ let myZeroTierEventCallback : @convention(c) (UnsafeMutableRawPointer?) -> Void
func main()
{
print("waiting for node to come online...")
zts_start("config_path", myZeroTierEventCallback, 0)
zts_start("config_path", on_zts_event, 0)
while(!nodeReady) {
sleep(1)
}