Beispiel #1
0
int doWriteRead( void * req, int size, rec_chif_resp * resp)
{
    int cnt = -1;

    init_rec();
    if (rec_fd < 0) 
        return -1;
    dump_chunk("rec:arch","WriteRead-write", (const u_char *)req, size);
    if ((cnt = write(rec_fd, req, size)) < 0) {
        DEBUGMSGTL(("rec:rec_log_error", "WriteRead write error = %d fd = %d\n",errno, rec_fd));
        close_rec(1);
        return -1;
    }
    DEBUGMSGTL(("rec:arch", "WriteRead write %d bytes fd = %d\n", cnt, rec_fd));

    usleep(5000);

    memset (resp, 0, sizeof(rec_chif_resp));
    while ((cnt = read(rec_fd, resp, sizeof(rec_chif_resp))) < 0) {
        if (cnt != EINTR) {
            DEBUGMSGTL(("rec:rec_log_error", "WriteRead read error = %d fd = %d\n",errno, rec_fd));
            close_rec(1);
            return -1;
        } else
            DEBUGMSGTL(("rec:rec_log_error", "WriteRead EINTR error = %d fd = %d\n",errno, rec_fd));
        DEBUGMSGTL(("rec:arch", "WriteRead read %d bytes fd = snmpHPILODomain.csnmpHPILODomain.c%d\n", cnt, rec_fd));
    }
    dump_chunk("rec:arch","WriteRead-read", (const u_char *)resp, cnt);
    DEBUGMSGTL(("rec:arch", "WriteRead-read %d bytes\n", cnt));
    return (resp->msg.rcode);
}
Beispiel #2
0
int doWrite( rec_chif_req * req, int size)
{
    int cnt = -1;

    init_rec();
    if (rec_fd == -1)
        return -1;

    req->hdr.pktsz = size;
    dump_chunk("rec:arch","Write", (const u_char *)req, size);
    if ((cnt = write(rec_fd, req, size)) < 0) {
        return -1;
    }
    DEBUGMSGTL(("rec:arch", "write %d bytes\n", cnt));
    return cnt;
}
Beispiel #3
0
void init_records(void)
{
    rec_descriptor_t *desc;
    bool done;
    do {
	done = true;
	for (desc = rec_descs; desc; desc = desc->rd_next) {
	    if (desc->rd_initialized)
		continue;
	    if (desc->rd_parent && is_uninitialized(*desc->rd_parent)) {
		done = false;
		continue;
	    } else {
		init_rec(desc);
		desc->rd_initialized = true;
	    }
	}
    } while (!done);
}
Beispiel #4
0
int doRead( void * resp, int size)
{
    int cnt = -1;

    init_rec();
    if (rec_fd == -1)
        return -1;

    while ((cnt = read(rec_fd, resp, size)) < 0) {
        if (cnt != EINTR) {
            DEBUGMSGTL(("rec:rec_log_error", "Read error = %d fd = %d\n",errno, rec_fd));
            return -1;
        } else 
            DEBUGMSGTL(("rec:rec_log_error", "EINTR error = %d fd = %d\n",errno, rec_fd));
    }
    DEBUGMSGTL(("rec:arch", "read %d bytes fd = %d\n", cnt, rec_fd));
    dump_chunk("rec:arch","Read", (const u_char *)resp, cnt);

    return (cnt);
}
Beispiel #5
0
static
long init_record_output(boRecord* prec)
{
  return init_rec((dbCommon*)prec,&prec->out);
}