]>
code.delx.au - pulseaudio/blob - polyp/authkey-prop.c
132279556db02d91a5bb207ce6147ef5fb195051
4 This file is part of polypaudio.
6 polypaudio is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published
8 by the Free Software Foundation; either version 2 of the License,
9 or (at your option) any later version.
11 polypaudio is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with polypaudio; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
26 #include "authkey-prop.h"
35 int pa_authkey_prop_get(struct pa_core
*c
, const char *name
, void *data
, size_t len
) {
36 struct authkey_data
*a
;
37 assert(c
&& name
&& data
&& len
> 0);
39 if (!(a
= pa_property_get(c
, name
)))
42 assert(a
->length
== len
);
43 memcpy(data
, a
+1, len
);
47 int pa_authkey_prop_put(struct pa_core
*c
, const char *name
, const void *data
, size_t len
) {
48 struct authkey_data
*a
;
51 if (pa_property_get(c
, name
))
54 a
= pa_xmalloc(sizeof(struct authkey_data
) + len
);
57 memcpy(a
+1, data
, len
);
59 pa_property_set(c
, name
, a
);
64 void pa_authkey_prop_ref(struct pa_core
*c
, const char *name
) {
65 struct authkey_data
*a
;
68 a
= pa_property_get(c
, name
);
69 assert(a
&& a
->ref
>= 1);
74 void pa_authkey_prop_unref(struct pa_core
*c
, const char *name
) {
75 struct authkey_data
*a
;
78 a
= pa_property_get(c
, name
);
79 assert(a
&& a
->ref
>= 1);
82 pa_property_remove(c
, name
);