Re: [gnet-dev] Request for Comments: GConnHttp



On Tue, Apr 20, 2004 at 05:14:34PM +0100, Tim M?ller wrote:
 
>  * I was aiming for a minimal API. Currently, the shortest way to retrieve a
>     file goes like this (without much error checking):
> 
> 	httpconn = gnet_conn_http_new();
> 	gnet_conn_http_set_uri (httpconn, "http://www.google.com";);
> 	if (gnet_conn_http_run (httpconn, NULL,NULL))
> 	{
> 		if (gnet_conn_http_steal_buffer(httpconn, &buf, &len))
> 		{
> 			g_print("Retrieved %u bytes:\n%s\n", len, buf);
> 			g_free(buf);
> 		}
> 	}
 
> * The namespace is a bit awkward, but still better than creating
>    confusion by clashing with the (abandoned?) ghttp library namespace.

I am working on an SNMP library (derived from gxsnmp, with lots of 
fixes and extensions) based on glib/gnet and I decided to use the 
prefix "gnet_snmp" so that you write code like this

    vb = gnet_snmp_varbind_new(iso_org, G_N_ELEMENTS(iso_org),
			       GNET_SNMP_VARBIND_TYPE_NULL, NULL, 0);
    in = g_list_append(in, vb);
    out = gnet_snmp_session_sync_walk(s, in);
    g_list_foreach(out, print, NULL);

to walk a MIB subtree. This approach is pretty extensible if we
envision that more protocols might eventually be added to gnet.

/js

-- 
Juergen Schoenwaelder		    International University Bremen
<http://www.eecs.iu-bremen.de/>	    P.O. Box 750 561, 28725 Bremen, Germany



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]