00001
00017 #include <libgdome/gdome.h>
00018
00020 typedef struct _macs_sock_struct {
00022 char *host;
00024 int port;
00026 int isup;
00028 int sock;
00033 int in_use;
00035 char *buf;
00037 int blen;
00039 struct _macs_sock_struct *next;
00040 } _macs_sock;
00041
00049 typedef struct _macs_context_struct {
00051 char *cf;
00053 GdomeDOMImplementation *dom;
00055 GdomeDocument *doc;
00057 GdomeElement *root;
00062 GdomeException e;
00064 _macs_sock *aucs;
00066 _macs_sock *upcs;
00068 _macs_sock *atcs;
00069 } _macs_ctx;
00070
00078 int _macs_connect_socks(_macs_ctx *ctx, int servers);
00079
00087 _macs_sock *_macs_get_sock(const _macs_ctx *ctx, int server);
00088
00096 int _macs_free_socks(_macs_ctx *ctx, int servers);
00097
00105 int _macs_add_server(_macs_ctx *ctx, const char *addr, int stype);
00106
00114 int _macs_do_ping(_macs_sock *s, int server);
00115
00131 int _macs_write(_macs_sock *s, const void *morsel, size_t siz,
00132 const char *svc, const char *cmd, const char *meth, ...);
00133
00148 int _macs_read(_macs_sock *s, char **reply[], char **morsel);
00149
00155 #define _macs_free_reply(R,M) \
00156 if (R) { free(*R); free(R); R=NULL; } \
00157 if (M) { free(M); M=NULL; }
00158
00163 #define _macs_close_sock(S) if (S) S->isup=S->in_use=0;
00164
00169 #define _macs_free_sock(S) if (S) S->in_use=0;
00170
00176 char *_macs_util_itoa(long int i);
00177
00184 char *_macs_util_adm2str(char **R, char *M);
00185
00191 char *_macs_util_type2str(macs_profile_type type);
00192
00198 char *_macs_util_svr2str(int server);