repositories
/
deb_shairplay.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Move hwaddress to raop_start instead of raop_init.
[deb_shairplay.git]
/
src
/
lib
/
raop.c
diff --git
a/src/lib/raop.c
b/src/lib/raop.c
index 850737e5c216b417daf4a23a3859d2588b0497b9..0a18391f77ba7e1b6e13dd6a7d5254dda2e44b83 100644
(file)
--- a/
src/lib/raop.c
+++ b/
src/lib/raop.c
@@
-234,7
+234,7
@@
conn_destroy(void *ptr)
}
raop_t *
}
raop_t *
-raop_init(raop_callbacks_t *callbacks, const char *pemkey
, const char *hwaddr, int hwaddrlen
)
+raop_init(raop_callbacks_t *callbacks, const char *pemkey)
{
raop_t *raop;
httpd_t *httpd;
{
raop_t *raop;
httpd_t *httpd;
@@
-243,7
+243,6
@@
raop_init(raop_callbacks_t *callbacks, const char *pemkey, const char *hwaddr, i
assert(callbacks);
assert(pemkey);
assert(callbacks);
assert(pemkey);
- assert(hwaddr);
/* Initialize the network */
if (netutils_init() < 0) {
/* Initialize the network */
if (netutils_init() < 0) {
@@
-257,11
+256,6
@@
raop_init(raop_callbacks_t *callbacks, const char *pemkey, const char *hwaddr, i
return NULL;
}
return NULL;
}
- /* Validate hardware address */
- if (hwaddrlen > MAX_HWADDR_LEN) {
- return NULL;
- }
-
/* Allocate the raop_t structure */
raop = calloc(1, sizeof(raop_t));
if (!raop) {
/* Allocate the raop_t structure */
raop = calloc(1, sizeof(raop_t));
if (!raop) {
@@
-299,15
+293,11
@@
raop_init(raop_callbacks_t *callbacks, const char *pemkey, const char *hwaddr, i
raop->httpd = httpd;
raop->rsakey = rsakey;
raop->httpd = httpd;
raop->rsakey = rsakey;
- /* Copy hwaddr to resulting structure */
- memcpy(raop->hwaddr, hwaddr, hwaddrlen);
- raop->hwaddrlen = hwaddrlen;
-
return raop;
}
raop_t *
return raop;
}
raop_t *
-raop_init_from_keyfile(raop_callbacks_t *callbacks, const char *keyfile
, const char *hwaddr, int hwaddrlen
)
+raop_init_from_keyfile(raop_callbacks_t *callbacks, const char *keyfile)
{
raop_t *raop;
char *pemstr;
{
raop_t *raop;
char *pemstr;
@@
-315,7
+305,7
@@
raop_init_from_keyfile(raop_callbacks_t *callbacks, const char *keyfile, const c
if (utils_read_file(&pemstr, keyfile) < 0) {
return NULL;
}
if (utils_read_file(&pemstr, keyfile) < 0) {
return NULL;
}
- raop = raop_init(callbacks, pemstr
, hwaddr, hwaddrlen
);
+ raop = raop_init(callbacks, pemstr);
free(pemstr);
return raop;
}
free(pemstr);
return raop;
}
@@
-336,10
+326,20
@@
raop_destroy(raop_t *raop)
}
int
}
int
-raop_start(raop_t *raop, unsigned short *port)
+raop_start(raop_t *raop, unsigned short *port
, const char *hwaddr, int hwaddrlen
)
{
assert(raop);
assert(port);
{
assert(raop);
assert(port);
+ assert(hwaddr);
+
+ /* Validate hardware address */
+ if (hwaddrlen > MAX_HWADDR_LEN) {
+ return -1;
+ }
+
+ /* Copy hwaddr to the raop structure */
+ memcpy(raop->hwaddr, hwaddr, hwaddrlen);
+ raop->hwaddrlen = hwaddrlen;
return httpd_start(raop->httpd, port);
}
return httpd_start(raop->httpd, port);
}