Imported Debian patch 0.1.0+git20131207+e452e83-0ubuntu12
[deb_libhybris.git] / hybris / include / hybris / properties / properties.h
1 /*
2 * Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com>
3 * 2013 Simon Busch <morphis@gravedo.de>
4 * 2008 The Android Open Source Project
5 * 2013 Canonical Ltd
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 */
20
21 #ifndef PROPERTIES_H_
22 #define PROPERTIES_H_
23
24 #include <stdint.h>
25 #include <unistd.h>
26 #include <stdint.h>
27
28 /* Based on Android */
29 #define PROP_SERVICE_NAME "property_service"
30
31 #define PROP_NAME_MAX 32
32 #define PROP_VALUE_MAX 92
33
34 /* Only SETPROP is defined by Android, for GETPROP and LISTPROP to work
35 * an extended Android init service needs to be in place */
36 #define PROP_MSG_SETPROP 1
37 #define PROP_MSG_GETPROP 2
38 #define PROP_MSG_LISTPROP 3
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 typedef struct prop_msg_s {
45 unsigned cmd;
46 char name[PROP_NAME_MAX];
47 char value[PROP_VALUE_MAX];
48 } prop_msg_t;
49
50 int property_set(const char *key, const char *value);
51 int property_get(const char *key, char *value, const char *default_value);
52 int property_list(void (*propfn)(const char *key, const char *value, void *cookie), void *cookie);
53
54 #ifdef __cplusplus
55 }
56 #endif
57
58 #endif // PROPERTIES_H_