Improves naming of session's module
[src/app-framework-binder.git] / src / afb-session.h
1 /*
2  * Copyright (C) 2016, 2017 "IoT.bzh"
3  * Author: José Bollo <jose.bollo@iot.bzh>
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *   http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 #pragma once
19
20 struct json_object;
21 struct afb_session;
22
23 extern void afb_session_init(int max_session_count, int timeout, const char *initok, int context_count);
24
25 extern struct afb_session *afb_session_create (const char *uuid, int timeout);
26 extern struct afb_session *afb_session_get (const char *uuid, int *created);
27 extern const char *afb_session_uuid (struct afb_session *session);
28
29 extern struct afb_session *afb_session_addref(struct afb_session *session);
30 extern void afb_session_unref(struct afb_session *session);
31
32 extern void afb_session_close(struct afb_session *session);
33
34 extern int afb_session_check_token(struct afb_session *session, const char *token);
35 extern void afb_session_new_token(struct afb_session *session);
36 extern const char *afb_session_token(struct afb_session *session);
37
38 extern unsigned afb_session_get_LOA(struct afb_session *session);
39 extern void afb_session_set_LOA (struct afb_session *session, unsigned loa);
40
41 extern void *afb_session_get_value(struct afb_session *session, int index);
42 extern void afb_session_set_value(struct afb_session *session, int index, void *value, void (*freecb)(void*));
43
44 extern void *afb_session_get_cookie(struct afb_session *session, const void *key);
45 extern int afb_session_set_cookie(struct afb_session *session, const void *key, void *value, void (*freecb)(void*));
46