libcoap  4.1.1
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
Macros | Functions | Variables
server.c File Reference
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <ctype.h>
#include <sys/select.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/stat.h>
#include <dirent.h>
#include <errno.h>
#include <signal.h>
#include "config.h"
#include "resource.h"
#include "coap.h"

Go to the source code of this file.

Macros

#define COAP_RESOURCE_CHECK_TIME   2
 
#define min(a, b)   ((a) < (b) ? (a) : (b))
 
#define INDEX
 

Functions

void handle_sigint (int signum)
 
void hnd_get_index (coap_context_t *ctx, struct coap_resource_t *resource, coap_address_t *peer, coap_pdu_t *request, str *token, coap_pdu_t *response)
 
void hnd_get_time (coap_context_t *ctx, struct coap_resource_t *resource, coap_address_t *peer, coap_pdu_t *request, str *token, coap_pdu_t *response)
 
void hnd_put_time (coap_context_t *ctx, struct coap_resource_t *resource, coap_address_t *peer, coap_pdu_t *request, str *token, coap_pdu_t *response)
 
void hnd_delete_time (coap_context_t *ctx, struct coap_resource_t *resource, coap_address_t *peer, coap_pdu_t *request, str *token, coap_pdu_t *response)
 
void hnd_get_async (coap_context_t *ctx, struct coap_resource_t *resource, coap_address_t *peer, coap_pdu_t *request, str *token, coap_pdu_t *response)
 
void check_async (coap_context_t *ctx, coap_tick_t now)
 
void init_resources (coap_context_t *ctx)
 
void usage (const char *program, const char *version)
 
coap_context_tget_context (const char *node, const char *port)
 
int main (int argc, char **argv)
 

Variables

static int quit = 0
 
static time_t my_clock_base = 0
 
struct coap_resource_ttime_resource = NULL
 
static coap_async_state_tasync = NULL
 

Macro Definition Documentation

#define COAP_RESOURCE_CHECK_TIME   2

Definition at line 30 of file server.c.

#define INDEX
Value:
"This is a test server made with libcoap (see http://libcoap.sf.net)\n" \
"Copyright (C) 2010--2013 Olaf Bergmann <bergmann@tzi.org>\n\n"

Definition at line 56 of file server.c.

#define min (   a,
 
)    ((a) < (b) ? (a) : (b))

Definition at line 33 of file server.c.

Function Documentation

void check_async ( coap_context_t ctx,
coap_tick_t  now 
)

Definition at line 218 of file server.c.

coap_context_t* get_context ( const char *  node,
const char *  port 
)

Definition at line 311 of file server.c.

void handle_sigint ( int  signum)

Definition at line 52 of file server.c.

void hnd_delete_time ( coap_context_t ctx,
struct coap_resource_t resource,
coap_address_t *  peer,
coap_pdu_t request,
str token,
coap_pdu_t response 
)

Definition at line 175 of file server.c.

void hnd_get_async ( coap_context_t ctx,
struct coap_resource_t resource,
coap_address_t *  peer,
coap_pdu_t request,
str token,
coap_pdu_t response 
)

Definition at line 186 of file server.c.

void hnd_get_index ( coap_context_t ctx,
struct coap_resource_t resource,
coap_address_t *  peer,
coap_pdu_t request,
str token,
coap_pdu_t response 
)

Definition at line 60 of file server.c.

void hnd_get_time ( coap_context_t ctx,
struct coap_resource_t resource,
coap_address_t *  peer,
coap_pdu_t request,
str token,
coap_pdu_t response 
)

Definition at line 77 of file server.c.

void hnd_put_time ( coap_context_t ctx,
struct coap_resource_t resource,
coap_address_t *  peer,
coap_pdu_t request,
str token,
coap_pdu_t response 
)

Definition at line 143 of file server.c.

void init_resources ( coap_context_t ctx)

Definition at line 257 of file server.c.

int main ( int  argc,
char **  argv 
)

Definition at line 353 of file server.c.

void usage ( const char *  program,
const char *  version 
)

Definition at line 294 of file server.c.

Variable Documentation

coap_async_state_t* async = NULL
static

Definition at line 47 of file server.c.

time_t my_clock_base = 0
static

Definition at line 40 of file server.c.

int quit = 0
static

Definition at line 37 of file server.c.

struct coap_resource_t* time_resource = NULL

Definition at line 42 of file server.c.