Check-in [495af83ca7]
Overview
Comment:Updated documentation to reflect addition of addr and hostname var types Updated addr and hostname types to be in network byte order
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:495af83ca76266f7b585bfa63fad2a91ee4365ff
User & Date: rkeene on 2006-12-17 15:30:30
Other Links: manifest | tags
Context
2006-12-17
19:15
libconfig 0.2.0 released check-in: f205c925b8 user: rkeene tags: trunk, 0.2.0
15:30
Updated documentation to reflect addition of addr and hostname var types Updated addr and hostname types to be in network byte order check-in: 495af83ca7 user: rkeene tags: trunk
03:48
Removed attempts to set lc_errno to NONE check-in: 8e434a0cbf user: rkeene tags: trunk
Changes

Modified lc_register_var.3.in from [26c717cf6a] to [218061b43e].

79
80
81
82
83
84
85
86
87



88
89
90
91
92
93
94
95
96
LC_VAR_BOOL_BY_EXISTANCE
This type of variable takes no arguments, it is set to true (1) by its existance in a configuration file, environment variable, or on the command line.  If it is not specified, the value of the data passed is not changed.  The data passed should be of type "int *".
.TP
LC_VAR_CIDR
This type of variable accepts a CIDR format netmask and IP.  This is not yet implemented. (XXX)
.TP
LC_VAR_IP
This type of variable accepts an IP address in decimal-dot format.  The value is stored in a uint32_t.
.TP



LC_VAR_ADDR
This type of variable accepts an address in either host or decimal-dot format.  The value is stored in a uint32_t.  This is not yet implemented. (XXX)

.SH "RETURN VALUE"
On success 0 is returned, otherwise -1 is returned.

.SH EXAMPLE
.nf
#include <libconfig.h>







|

>
>
>

|







79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
LC_VAR_BOOL_BY_EXISTANCE
This type of variable takes no arguments, it is set to true (1) by its existance in a configuration file, environment variable, or on the command line.  If it is not specified, the value of the data passed is not changed.  The data passed should be of type "int *".
.TP
LC_VAR_CIDR
This type of variable accepts a CIDR format netmask and IP.  This is not yet implemented. (XXX)
.TP
LC_VAR_IP
This type of variable accepts an IP address in decimal-dot format.  The value is stored in a uint32_t in network byte order.
.TP
LC_VAR_HOSTNAME
This type of variable accepts an address in hostname format.  The value is stored in a uint32_t in network byte order.
.TP
LC_VAR_ADDR
This type of variable accepts an address in either hostname or decimal-dot format.  The value is stored in a uint32_t in network byte order.

.SH "RETURN VALUE"
On success 0 is returned, otherwise -1 is returned.

.SH EXAMPLE
.nf
#include <libconfig.h>

Modified libconfig.c from [b750f5ace4] to [41938c6e31].

71
72
73
74
75
76
77




78
79
80
81
82
83
84
85
86
87
88
89
...
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117



118
119
120
121
122
123
124
125
126
127
128
129




130
131
132
133
134
135
136
137
138
139
140
	if (ghbn_ret == NULL) {
		return(-1);
	}

	if (ghbn_ret->h_length != 4) {
		return(-1);
	}





	memcpy(data, ghbn_ret->h_addr_list[0], sizeof(*data));

	*data = ntohl(*data);

	return(0);
}

static int lc_process_var_hostname6(void *data, const char *value, const char **endptr) {
	return(-1);
}

................................................................................
				}

				if (curr_ipval > 255) {
					retval = -1;
					break;
				}

				ipval <<= 8;
				ipval |= curr_ipval;
				curr_ipval = 0;

				/* For lists */
				if (*valptr == ',') {
					break;
				}




				continue;
			} else {
				retval = -1;
				break;
			}
		}

		curr_ipval *= 10;
		curr_ipval += *valptr - '0';
	}





	if (retval == 0) {
		ipval <<= 8;
		ipval |= curr_ipval;

		*data = ipval;
	}

	return(retval);
}

static int lc_process_var_ip6(void *data, const char *value, const char **endptr) {







>
>
>
>



<
<







 







<
<
<
<




>
>
>












>
>
>
>

<
|
<







71
72
73
74
75
76
77
78
79
80
81
82
83
84


85
86
87
88
89
90
91
...
105
106
107
108
109
110
111




112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135

136

137
138
139
140
141
142
143
	if (ghbn_ret == NULL) {
		return(-1);
	}

	if (ghbn_ret->h_length != 4) {
		return(-1);
	}

	if (ghbn_ret->h_addr_list[0] == 0) {
		return(-1);
	}

	memcpy(data, ghbn_ret->h_addr_list[0], sizeof(*data));



	return(0);
}

static int lc_process_var_hostname6(void *data, const char *value, const char **endptr) {
	return(-1);
}

................................................................................
				}

				if (curr_ipval > 255) {
					retval = -1;
					break;
				}





				/* For lists */
				if (*valptr == ',') {
					break;
				}

				ipval |= curr_ipval << ((dotcount - 1) * 8);
				curr_ipval = 0;

				continue;
			} else {
				retval = -1;
				break;
			}
		}

		curr_ipval *= 10;
		curr_ipval += *valptr - '0';
	}

	if (curr_ipval > 255) {
		retval = -1;
	}

	if (retval == 0) {

		ipval |= curr_ipval << 24;

		*data = ipval;
	}

	return(retval);
}

static int lc_process_var_ip6(void *data, const char *value, const char **endptr) {