Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sol-lwm2m-server.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Soletta (TM) Project
3  *
4  * Copyright (C) 2015 Intel Corporation. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 #pragma once
19 
20 #include "sol-lwm2m.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
46 struct sol_lwm2m_server;
48 
56 
80 };
81 
100 struct sol_lwm2m_server *sol_lwm2m_server_new(uint16_t coap_port,
101  uint16_t num_sec_modes, ...);
102 
118  void (*sol_lwm2m_server_registration_event_cb)(void *data,
119  struct sol_lwm2m_server *server,
120  struct sol_lwm2m_client_info *cinfo,
121  enum sol_lwm2m_registration_event event),
122  const void *data);
123 
134  void (*sol_lwm2m_server_registration_event_cb)(void *data,
135  struct sol_lwm2m_server *server,
136  struct sol_lwm2m_client_info *cinfo,
137  enum sol_lwm2m_registration_event event),
138  const void *data);
139 
148 const struct sol_ptr_vector *sol_lwm2m_server_get_clients(const struct sol_lwm2m_server *server);
149 
164  struct sol_lwm2m_client_info *client,
165  const char *path,
166  void (*sol_lwm2m_server_content_cb)(void *data,
167  struct sol_lwm2m_server *server,
168  struct sol_lwm2m_client_info *client,
169  const char *path,
170  enum sol_coap_response_code response_code,
171  enum sol_lwm2m_content_type content_type,
172  struct sol_str_slice content),
173  const void *data);
174 
189  struct sol_lwm2m_client_info *client,
190  const char *path,
191  void (*sol_lwm2m_server_content_cb)(void *data,
192  struct sol_lwm2m_server *server,
193  struct sol_lwm2m_client_info *client,
194  const char *path,
195  enum sol_coap_response_code response_code,
196  enum sol_lwm2m_content_type content_type,
197  struct sol_str_slice content),
198  const void *data);
199 
214 int sol_lwm2m_server_write(struct sol_lwm2m_server *server,
215  struct sol_lwm2m_client_info *client, const char *path,
216  struct sol_lwm2m_resource *resources, size_t len,
217  void (*sol_lwm2m_server_management_status_response_cb)(void *data,
218  struct sol_lwm2m_server *server,
219  struct sol_lwm2m_client_info *client, const char *path,
220  enum sol_coap_response_code response_code),
221  const void *data);
222 
234  struct sol_lwm2m_client_info *client, const char *path,
235  void (*sol_lwm2m_server_management_status_response_cb)(void *data,
236  struct sol_lwm2m_server *server,
237  struct sol_lwm2m_client_info *client, const char *path,
238  enum sol_coap_response_code response_code),
239  const void *data);
240 
253  struct sol_lwm2m_client_info *client, const char *path, const char *args,
254  void (*sol_lwm2m_server_management_status_response_cb)(void *data,
255  struct sol_lwm2m_server *server,
256  struct sol_lwm2m_client_info *client, const char *path,
257  enum sol_coap_response_code response_code),
258  const void *data);
259 
275  struct sol_lwm2m_client_info *client, const char *path,
276  struct sol_lwm2m_resource *resources, size_t len,
277  void (*sol_lwm2m_server_management_status_response_cb)(void *data,
278  struct sol_lwm2m_server *server,
279  struct sol_lwm2m_client_info *client, const char *path,
280  enum sol_coap_response_code response_code),
281  const void *data);
282 
293 int sol_lwm2m_server_read(struct sol_lwm2m_server *server,
294  struct sol_lwm2m_client_info *client,
295  const char *path,
296  void (*sol_lwm2m_server_content_cb)(void *data,
297  struct sol_lwm2m_server *server,
298  struct sol_lwm2m_client_info *client,
299  const char *path,
300  enum sol_coap_response_code response_code,
301  enum sol_lwm2m_content_type content_type,
302  struct sol_str_slice content),
303  const void *data);
304 
313 void sol_lwm2m_server_del(struct sol_lwm2m_server *server);
314 
321 const char *sol_lwm2m_client_info_get_name(const struct sol_lwm2m_client_info *client);
322 
332 const char *sol_lwm2m_client_info_get_location(const struct sol_lwm2m_client_info *client);
333 
342 const char *sol_lwm2m_client_info_get_sms_number(const struct sol_lwm2m_client_info *client);
343 
353 const char *sol_lwm2m_client_info_get_objects_path(const struct sol_lwm2m_client_info *client);
354 
362 int sol_lwm2m_client_info_get_lifetime(const struct sol_lwm2m_client_info *client, uint32_t *lifetime);
363 
371 
379 
392 
396 #ifdef __cplusplus
397 }
398 #endif
int sol_lwm2m_server_del_registration_monitor(struct sol_lwm2m_server *server, void(*sol_lwm2m_server_registration_event_cb)(void *data, struct sol_lwm2m_server *server, struct sol_lwm2m_client_info *cinfo, enum sol_lwm2m_registration_event event), const void *data)
Removes a registration monitor.
const struct sol_ptr_vector * sol_lwm2m_server_get_clients(const struct sol_lwm2m_server *server)
Gets all registerd clients.
int sol_lwm2m_server_del_observer(struct sol_lwm2m_server *server, struct sol_lwm2m_client_info *client, const char *path, void(*sol_lwm2m_server_content_cb)(void *data, struct sol_lwm2m_server *server, struct sol_lwm2m_client_info *client, const char *path, enum sol_coap_response_code response_code, enum sol_lwm2m_content_type content_type, struct sol_str_slice content), const void *data)
Unobserve a client object, instance or resource.
int sol_lwm2m_client_info_get_lifetime(const struct sol_lwm2m_client_info *client, uint32_t *lifetime)
Gets the client lifetime in seconds.
const char * sol_lwm2m_client_info_get_sms_number(const struct sol_lwm2m_client_info *client)
Gets the client SMS number.
static struct sol_http_server * server
Definition: server-https.c:52
int sol_lwm2m_server_add_observer(struct sol_lwm2m_server *server, struct sol_lwm2m_client_info *client, const char *path, void(*sol_lwm2m_server_content_cb)(void *data, struct sol_lwm2m_server *server, struct sol_lwm2m_client_info *client, const char *path, enum sol_coap_response_code response_code, enum sol_lwm2m_content_type content_type, struct sol_str_slice content), const void *data)
Observes a client object, instance or resource.
Indicates that a client was registered in the server.
Definition: sol-lwm2m-server.h:66
Indicates that a client was unregistered.
Definition: sol-lwm2m-server.h:74
sol_lwm2m_binding_mode
LWM2M Client binding mode.
Definition: sol-lwm2m.h:100
Indicates that the server is discarding a client, since the server did not hear from it after some ti...
Definition: sol-lwm2m-server.h:79
Routines that handle the LWM2M protocol.
int sol_lwm2m_server_read(struct sol_lwm2m_server *server, struct sol_lwm2m_client_info *client, const char *path, void(*sol_lwm2m_server_content_cb)(void *data, struct sol_lwm2m_server *server, struct sol_lwm2m_client_info *client, const char *path, enum sol_coap_response_code response_code, enum sol_lwm2m_content_type content_type, struct sol_str_slice content), const void *data)
Reads an object, instance or resource from a client.
String slice type.
Definition: sol-str-slice.h:84
int sol_lwm2m_server_write(struct sol_lwm2m_server *server, struct sol_lwm2m_client_info *client, const char *path, struct sol_lwm2m_resource *resources, size_t len, void(*sol_lwm2m_server_management_status_response_cb)(void *data, struct sol_lwm2m_server *server, struct sol_lwm2m_client_info *client, const char *path, enum sol_coap_response_code response_code), const void *data)
Writes an object instance or resource.
enum sol_lwm2m_binding_mode sol_lwm2m_client_info_get_binding_mode(const struct sol_lwm2m_client_info *client)
Gets the client binding mode.
sol_coap_response_code
Set of response codes available for a response packet.
Definition: sol-coap.h:190
struct sol_lwm2m_client_info sol_lwm2m_client_info
A handle that contains information about a registered LWM2M client.
Definition: sol-lwm2m-server.h:55
void sol_lwm2m_server_del(struct sol_lwm2m_server *server)
Deletes a server instance.
const char * sol_lwm2m_client_info_get_location(const struct sol_lwm2m_client_info *client)
Gets the client location path in the LWM2M server.
const char * sol_lwm2m_client_info_get_objects_path(const struct sol_lwm2m_client_info *client)
Gets the client objects path.
int sol_lwm2m_server_execute_resource(struct sol_lwm2m_server *server, struct sol_lwm2m_client_info *client, const char *path, const char *args, void(*sol_lwm2m_server_management_status_response_cb)(void *data, struct sol_lwm2m_server *server, struct sol_lwm2m_client_info *client, const char *path, enum sol_coap_response_code response_code), const void *data)
Executes an resource on a client.
int sol_lwm2m_server_delete_object_instance(struct sol_lwm2m_server *server, struct sol_lwm2m_client_info *client, const char *path, void(*sol_lwm2m_server_management_status_response_cb)(void *data, struct sol_lwm2m_server *server, struct sol_lwm2m_client_info *client, const char *path, enum sol_coap_response_code response_code), const void *data)
Deletes an object instance on a client.
int sol_lwm2m_server_add_registration_monitor(struct sol_lwm2m_server *server, void(*sol_lwm2m_server_registration_event_cb)(void *data, struct sol_lwm2m_server *server, struct sol_lwm2m_client_info *cinfo, enum sol_lwm2m_registration_event event), const void *data)
Adds a registration monitor.
sol_lwm2m_content_type
Enum that represents a LWM2M response/request content type.
Definition: sol-lwm2m.h:181
const struct sol_network_link_addr * sol_lwm2m_client_info_get_address(const struct sol_lwm2m_client_info *client)
Gets the client address.
sol_lwm2m_registration_event
Enum that expresses a LWM2M client lifecycle changes.
Definition: sol-lwm2m-server.h:62
struct sol_lwm2m_server * sol_lwm2m_server_new(uint16_t coap_port, uint16_t num_sec_modes,...)
Creates a new LWM2M server.
Soletta pointer vector is a wrapper around vector with an API more convenient to handle pointers...
Definition: sol-vector.h:310
struct sol_lwm2m_server sol_lwm2m_server
A handle to a LWM2M server.
Definition: sol-lwm2m-server.h:47
int sol_lwm2m_server_create_object_instance(struct sol_lwm2m_server *server, struct sol_lwm2m_client_info *client, const char *path, struct sol_lwm2m_resource *resources, size_t len, void(*sol_lwm2m_server_management_status_response_cb)(void *data, struct sol_lwm2m_server *server, struct sol_lwm2m_client_info *client, const char *path, enum sol_coap_response_code response_code), const void *data)
Creates an object instance on a client.
const struct sol_ptr_vector * sol_lwm2m_client_info_get_objects(const struct sol_lwm2m_client_info *client)
Get client's objects.
Indicates that a client updated itself in the server.
Definition: sol-lwm2m-server.h:70
Struct that represents a LWM2M resource.
Definition: sol-lwm2m.h:355
const char * sol_lwm2m_client_info_get_name(const struct sol_lwm2m_client_info *client)
Gets the name of client.