mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-09 18:32:53 +03:00
This modification provides two new functions, coap_run_once() and coap_run(), that can be used by applications to drive the library's I/O logic.
38 lines
1.1 KiB
C
38 lines
1.1 KiB
C
/*
|
|
* run.h -- CoAP main loop
|
|
*
|
|
* Copyright (C) 2016 Olaf Bergmann <bergmann@tzi.org>
|
|
*
|
|
* This file is part of the CoAP library libcoap. Please see README for terms
|
|
* of use.
|
|
*/
|
|
|
|
#ifndef _COAP_RUN_H_
|
|
#define _COAP_RUN_H_
|
|
|
|
#include "net.h"
|
|
|
|
/**
|
|
* Execute a single send/receive step. This function sends out any due
|
|
* message from the sendqueue and then waits up to @p timeout_ms
|
|
* milliseconds for incoming messages on the endpoints that are
|
|
* attached to @p ctx. The return value is less than zero on error or
|
|
* the number of milliseconds that have passed while waiting.
|
|
*
|
|
* @param ctx The context to operate on.
|
|
* @param timeout_ms The timeout in milliseconds.
|
|
* @return The number of milliseconds that have passed since the
|
|
* operation has started or a value less than zero on error.
|
|
*/
|
|
int coap_run_once(coap_context_t *ctx, unsigned int timeout_ms);
|
|
|
|
/**
|
|
* Simple main loop. This function infinitely runs coap_run_once()
|
|
* on the given context @p ctx.
|
|
*
|
|
* @param ctx The context to operate on.
|
|
*/
|
|
void coap_run(coap_context_t *ctx);
|
|
|
|
#endif /* COAP_RUN_H */
|