• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/uclient/uclient-backend.h

  1 /*
  2  * uclient - ustream based protocol client library
  3  *
  4  * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
  5  *
  6  * Permission to use, copy, modify, and/or distribute this software for any
  7  * purpose with or without fee is hereby granted, provided that the above
  8  * copyright notice and this permission notice appear in all copies.
  9  *
 10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 17  */
 18 #ifndef __UCLIENT_INTERNAL_H
 19 #define __UCLIENT_INTERNAL_H
 20 
 21 struct uclient_url;
 22 
 23 struct uclient_backend {
 24         const char * const * prefix;
 25 
 26         struct uclient *(*alloc)(void);
 27         void (*free)(struct uclient *cl);
 28         void (*update_proxy_url)(struct uclient *cl);
 29         void (*update_url)(struct uclient *cl);
 30 
 31         int (*connect)(struct uclient *cl);
 32         int (*request)(struct uclient *cl);
 33         void (*disconnect)(struct uclient *cl);
 34 
 35         int (*read)(struct uclient *cl, char *buf, unsigned int len);
 36         int (*write)(struct uclient *cl, const char *buf, unsigned int len);
 37         int (*pending_bytes)(struct uclient *cl, bool write);
 38 };
 39 
 40 void uclient_backend_set_error(struct uclient *cl, int code);
 41 void uclient_backend_set_eof(struct uclient *cl);
 42 void uclient_backend_reset_state(struct uclient *cl);
 43 struct uclient_url *uclient_get_url(const char *url_str, const char *auth_str);
 44 struct uclient_url *uclient_get_url_location(struct uclient_url *url, const char *location);
 45 static inline void uclient_backend_read_notify(struct uclient *cl)
 46 {
 47         uloop_timeout_set(&cl->read_notify, 1);
 48 }
 49 
 50 #endif
 51 

This page was automatically generated by LXR 0.3.1.  •  OpenWrt