/*
 * Put a long in host order into a char array in network order.
 *
 */
static inline char *aniAsfWr32(char *cp, tANI_U32 x)
{
    tAniU32ValAry r;
    int i;

    r.val = vos_cpu_to_be32(x);
    i = sizeof(tANI_U32) - 1;
    cp[3] = r.ary[i--];
    cp[2] = r.ary[i--];
    cp[1] = r.ary[i--];
    cp[0] = r.ary[i];

    return (cp + sizeof(tANI_U32));
}
static int
updateCtrBuf(tAniSsmReplayCtr *ctr)
{

    v_U32_t numBytes;
    v_U32_t offset;
    v_U32_t tmp;

    tmp = vos_cpu_to_be32( ctr->currentValue );

    numBytes = (4 <= ctr->size) ? 4 : ctr->size;
    offset = 4 - numBytes;
    vos_mem_copy(ctr->buf + ctr->size - numBytes, 
           ((v_U8_t *) &tmp) + offset, numBytes);

    return ANI_OK;
}
/**
 * aniAsfPacketAppend32
 *
 * FUNCTION:
 * Appends a ANI_U32 to the end of the packet.
 * All host to network byte order translation is also taken care of.
 *
 * @param packet the packet to write to
 * @param val the value to append
 *
 * @return ANI_OK if the operation succeeds
 */
int
aniAsfPacketAppend32(tAniPacket *packet, v_U32_t val)
{
    v_U8_t *p8;

    if (packet == NULL)
        return ANI_E_NULL_VALUE;

    if (TAIL_SPACE(packet) < 4)
        return ANI_E_FAILED;

    val = vos_cpu_to_be32( val );
    p8 = (v_U8_t *)&val;
    packet->tail[0] =  p8[0];
    packet->tail[1] =  p8[1];
    packet->tail[2] =  p8[2];
    packet->tail[3] =  p8[3];
    aniAsfPacketMoveRight(packet, 4);

    return ANI_OK;
}