예제 #1
0
static void write_unicode(GByteArray * bplist, gunichar2 * val, uint64_t size)
{
    uint64_t i = 0;
    uint64_t size2 = size * sizeof(gunichar2);
    uint8_t *buff = (uint8_t *) malloc(size2);
    memcpy(buff, val, size2);
    for (i = 0; i < size; i++)
        byte_convert(buff + i * sizeof(gunichar2), sizeof(gunichar2));
    write_raw_data(bplist, BPLIST_UNICODE, buff, size);
}
예제 #2
0
int parse_dnskey(unsigned char *data, unsigned short data_len, char *output_buf, size_t output_buf_size)
{
    unsigned short flags = parse_to_ushort(data);
    unsigned char protocol = *(data + 2);
    unsigned char algorithm = *(data + 3);
    int i = 0;
    int taken = 0;
    while (i < data_len - 4)
    {
        taken += write_raw_data(output_buf, output_buf_size, data + i + 4);
        ++i;
    }
    taken += write_endl(output_buf, output_buf_size);
    return taken;
}
예제 #3
0
int parse_default(unsigned char *data, unsigned short data_len, char *output_buf, size_t output_buf_size)
{
    int i = 0;
    if (data_len == 0)
    {
        return;
    }
    int taken = 0;

    while (i < data_len)
    {
        taken += write_raw_data(output_buf, output_buf_size, data + i);
        ++i;
    }
    taken += write_endl(output_buf, output_buf_size);
    return taken;
}
예제 #4
0
int son_write_data(son_t * h, const char * key, const void * v, son_size_t size){
	return write_raw_data(h, key, SON_DATA, v, size);
}
예제 #5
0
int son_write_null(son_t * h, const char * key){
	return write_raw_data(h, key, SON_NULL, 0, 0);
}
예제 #6
0
int son_write_false(son_t * h, const char * key){
	return write_raw_data(h, key, SON_FALSE, 0, 0);
}
예제 #7
0
int son_write_true(son_t * h, const char * key){
	return write_raw_data(h, key, SON_TRUE, 0, 0);
}
예제 #8
0
int son_write_float(son_t * h, const char * key, float v){
	return write_raw_data(h, key, SON_FLOAT, &v, sizeof(float));
}
예제 #9
0
int son_write_unum(son_t * h, const char * key, u32 v){
	return write_raw_data(h, key, SON_NUMBER_U32, &v, sizeof(v));
}
예제 #10
0
int son_write_str(son_t * h, const char * key, const char * v){
	//add one to the string length so that the zero terminator is saved
	return write_raw_data(h, key, SON_STRING, v, strlen(v)+1);
}
예제 #11
0
static void write_string(GByteArray * bplist, char *val)
{
    uint64_t size = strlen(val);
    write_raw_data(bplist, BPLIST_STRING, (uint8_t *) val, size);
}
예제 #12
0
static void write_data(GByteArray * bplist, uint8_t * val, uint64_t size)
{
    write_raw_data(bplist, BPLIST_DATA, val, size);
}