Example #1
0
int GRecvInt()
{
    int val;

    GDebug("Receiving int from %s ...\n", who);
    GRead(&val, sizeof(val));
    GDebug(" -> %d (%#x)\n", val, val);
    return val;
}
Example #2
0
char *GRecvStr()
{
    int len;
    char *buf;

    GDebug("Receiving string from %s ...\n", who);
    buf = iGRecvArr(&len);
    GDebug(" -> %'.*s\n", len, buf);
    return buf;
}
Example #3
0
char *GRecvArr(int *num)
{
    char *arr;

    GDebug("Receiving array from %s ...\n", who);
    GRead(num, sizeof(*num));
    GDebug(" -> %d bytes\n", *num);
    if(!*num)
        return (char *)0;
    if(!(arr = malloc(*num)))
        LogPanic("No memory for read buffer\n");
    GRead(arr, *num);
    GDebug(" -> %02[*hhx\n", *num, arr);
    return arr;
}
Example #4
0
void GSendStr(const char *buf)
{
    int len = buf ? strlen(buf) + 1 : 0;
    GDebug("Sending string %'s to %s\n", buf, who);
    GWrite(&len, sizeof(len));
    GWrite(buf, len);
}
Example #5
0
void
GSendArr( int len, const char *buf )
{
    GDebug( "Sending array %02[:*hhx to %s\n", len, buf, who );
    GWrite( &len, sizeof(len) );
    GWrite( buf, len );
}
Example #6
0
static char *iGRecvArr(int *rlen)
{
    int len;
    char *buf;

    GRead(&len, sizeof(len));
    *rlen = len;
    GDebug(" -> %d bytes\n", len);
    if(!len)
        return (char *)0;
    if(!(buf = malloc(len)))
        LogPanic("No memory for read buffer\n");
    GRead(buf, len);
    return buf;
}
Example #7
0
void GSendInt(int val)
{
    GDebug("Sending int %d (%#x) to %s\n", val, val, who);
    GWrite(&val, sizeof(val));
}