X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuclient.git;a=blobdiff_plain;f=uclient-backend.h;h=a5cf4f3d392ab9fd5fa2a6510d49c0f6bcfb355b;hp=5f83995d5835932ea3a5734c3c24cc250859dac8;hb=c8e85b4714709aebaa055bea6cc5a26b8eda4071;hpb=9099aff296c1fdc4ba49908018b46f913fe7d9e7 diff --git a/uclient-backend.h b/uclient-backend.h index 5f83995..a5cf4f3 100644 --- a/uclient-backend.h +++ b/uclient-backend.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 __UCLIENT_INTERNAL_H #define __UCLIENT_INTERNAL_H @@ -8,27 +25,19 @@ struct uclient_backend { struct uclient *(*alloc)(void); void (*free)(struct uclient *cl); + void (*update_url)(struct uclient *cl); int (*connect)(struct uclient *cl); int (*request)(struct uclient *cl); + void (*disconnect)(struct uclient *cl); int (*read)(struct uclient *cl, char *buf, unsigned int len); int (*write)(struct uclient *cl, char *buf, unsigned int len); }; -struct uclient_url { - const struct uclient_backend *backend; - int prefix; - - const char *host; - const char *port; - const char *location; - - const char *auth; -}; - -extern const struct uclient_backend uclient_backend_http; +void uclient_backend_set_error(struct uclient *cl, int code); void uclient_backend_set_eof(struct uclient *cl); void uclient_backend_reset_state(struct uclient *cl); +struct uclient_url *uclient_get_url(const char *url_str, const char *auth_str); #endif