X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuclient.git;a=blobdiff_plain;f=uclient.h;h=e8214c28008ef7ee3258073dfd94ccfe662baea5;hp=79ec0b7e0185390f28a4de2e4afb9b82a5ccebcc;hb=438ebb9ce2bfd5cf3ab940667029c27346dc5160;hpb=25e44fc1e666fb333b3c53bcda90e44b0b74bf19 diff --git a/uclient.h b/uclient.h index 79ec0b7..e8214c2 100644 --- a/uclient.h +++ b/uclient.h @@ -1,3 +1,20 @@ +/* + * uclient - ustream based protocol client library + * + * Copyright (C) 2014 Felix Fietkau + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ #ifndef __LIBUBOX_UCLIENT_H #define __LIBUBOX_UCLIENT_H @@ -38,16 +55,11 @@ struct uclient_cb { void (*error)(struct uclient *cl, int code); }; -struct uclient *uclient_new(const char *url, const struct uclient_cb *cb); +struct uclient *uclient_new(const char *url, const char *auth_str, const struct uclient_cb *cb); void uclient_free(struct uclient *cl); -int uclient_connect_url(struct uclient *cl, const char *url_str); - -static inline int uclient_connect(struct uclient *cl) -{ - return uclient_connect_url(cl, NULL); -} - +int uclient_set_url(struct uclient *cl, const char *url, const char *auth); +int uclient_connect(struct uclient *cl); int uclient_read(struct uclient *cl, char *buf, int len); int uclient_write(struct uclient *cl, char *buf, int len);