THRPLUSLIB:=libglite_lb_clientpp_${thrflavour}.la
TOOLS:=dump load purge
-#EXAMPLES:=feed_shark
-EXAMPLES:=
+EXAMPLES:=log_usertag_proxy job_reg feed_shark
${LIB}: ${LIBOBJS}
${LINK} -o $@ ${LIBLOBJS} -rpath ${glite_location}/lib -lglite_lb_common_${nothrflavour}
default: all
+
compile all: ${LIB} ${THRLIB} ${TOOLS} logevent ${EXAMPLES} ${PLUSLIB} ${THRPLUSLIB}
+examples: ${EXAMPLES}
+
check: compile check.producer
check.producer: producer_test
*/
static
int
-get_reply(edg_wll_Context context, int sock, char **buf, int *code_min)
+get_reply(edg_wll_Context context, edg_wll_Connection *conn, char **buf, int *code_min)
{
char buffer[17];
char *msg, *p;
code = 0;
/* get message header */
- len = edg_wll_plain_read_fullbuf(sock, buffer, 17, &context->p_tmp_timeout);
+ len = edg_wll_plain_read_full(conn, buffer, 17, &context->p_tmp_timeout);
if(len < 0) {
edg_wll_SetError(context,LB_PROTO,"get_reply(): error reading message header");
goto get_reply_end;
}
/* read all the data */
- len = edg_wll_plain_read_fullbuf(sock, msg, len, &context->p_tmp_timeout);
+ len = edg_wll_plain_read_full(conn, msg, len, &context->p_tmp_timeout);
if(len < 0) {
edg_wll_SetError(context,LB_PROTO,"get_reply(): error reading message body");
goto get_reply_end;
*
*----------------------------------------------------------------------
*/
-int edg_wll_log_proto_client_proxy(edg_wll_Context context, int socket, edg_wll_LogLine logline)
+int edg_wll_log_proto_client_proxy(edg_wll_Context context, edg_wll_Connection *conn, edg_wll_LogLine logline)
{
char *p; int len;
char *ucs = "honik6";
#ifdef EDG_WLL_LOG_STUB
fprintf(stderr,"Sending message to socket...\n");
#endif
- if (( count = edg_wll_plain_write_full(socket, buffer, size, &context->p_tmp_timeout)) < 0) {
+ if (( count = edg_wll_plain_write_full(conn, buffer, size, &context->p_tmp_timeout)) < 0) {
edg_wll_SetError(context,LB_PROTO,"edg_wll_log_proto_client_proxy(): error sending message to socket");
goto edg_wll_log_proto_client_proxy_end;
}
fprintf(stderr,"Reading answer from server...\n");
#endif
count = 0;
- if ((err = get_reply(context, socket, &answer, &code)) < 0 ) {
+ if ((err = get_reply(context, conn, &answer, &code)) < 0 ) {
edg_wll_SetError(context,LB_PROTO,"edg_wll_log_proto_client_proxy(): error reading answer from L&B proxy server");
} else {
#ifdef EDG_WLL_LOG_STUB
int edg_wll_log_proto_client(edg_wll_Context context, edg_wll_GssConnection *con, edg_wll_LogLine logline/*, int priority,*/);
int edg_wll_log_proto_client_failure(edg_wll_Context context, int code, edg_wll_GssStatus *gss_code, const char *text);
-int edg_wll_log_proto_client_proxy(edg_wll_Context context, int socket, edg_wll_LogLine logline);
+int edg_wll_log_proto_client_proxy(edg_wll_Context context, edg_wll_Connection *conn, edg_wll_LogLine logline);
#ifdef __cplusplus
}
#include "prod_proto.h"
-static const char* socket_path="/tmp/lbproxy.sock";
+static const char* socket_path="/tmp/lb_proxy_store.sock";
/**
*----------------------------------------------------------------------
{
int answer;
struct sockaddr_un saddr;
- int sock,flags;
+ int flags;
+ edg_wll_Connection conn;
edg_wll_ResetError(context);
answer = 0;
/* open a connection to the L&B Proxy: */
#ifdef EDG_WLL_LOG_STUB
- fprintf(stderr,"Logging to L&B Proxy at socket %s\n", socketpath);
+ fprintf(stderr,"Logging to L&B Proxy at socket %s\n",
+ context->p_lbproxy_store_sock? context->p_lbproxy_store_sock: socket_path);
#endif
- sock = socket(PF_UNIX, SOCK_STREAM, 0);
- if (sock < 0) {
+ conn.sock = socket(PF_UNIX, SOCK_STREAM, 0);
+ if (conn.sock < 0) {
edg_wll_SetError(context,answer = errno,"socket() error");
goto edg_wll_DoLogEventProxy_end;
}
memset(&saddr, 0, sizeof(saddr));
saddr.sun_family = AF_UNIX;
- strcpy(saddr.sun_path, socket_path);
- if ((flags = fcntl(sock, F_GETFL, 0)) < 0 || fcntl(sock, F_SETFL, flags | O_NONBLOCK) < 0) {
+ strcpy(saddr.sun_path, context->p_lbproxy_store_sock?
+ context->p_lbproxy_store_sock: socket_path);
+ if ((flags = fcntl(conn.sock, F_GETFL, 0)) < 0 || fcntl(conn.sock, F_SETFL, flags | O_NONBLOCK) < 0) {
edg_wll_SetError(context,answer = errno,"fcntl()");
- close(sock);
+ close(conn.sock);
goto edg_wll_DoLogEventProxy_end;
}
- if (connect(sock, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) {
+ if (connect(conn.sock, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) {
if(errno != EISCONN) {
edg_wll_SetError(context,answer = errno,"connect()");
- close(sock);
+ close(conn.sock);
goto edg_wll_DoLogEventProxy_end;
}
}
/* and send the message to the L&B Proxy: */
-// answer = edg_wll_log_proto_client_proxy(context,&sock,logline);
- answer = EAGAIN;
+ answer = edg_wll_log_proto_client_proxy(context,&conn,logline);
- close(sock);
+ close(conn.sock);
edg_wll_DoLogEventProxy_end: