Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dhcp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
68
Issues
68
List
Boards
Labels
Service Desk
Milestones
Merge Requests
17
Merge Requests
17
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
dhcp
Commits
d142e03f
Commit
d142e03f
authored
Sep 08, 1999
by
Ted Lemon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test program for dhcpctl
parent
dc246694
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
3 deletions
+113
-3
dhcpctl/Makefile.dist
dhcpctl/Makefile.dist
+3
-3
dhcpctl/test.c
dhcpctl/test.c
+110
-0
No files found.
dhcpctl/Makefile.dist
View file @
d142e03f
...
...
@@ -27,10 +27,10 @@ DEBUG = -g
INCLUDES
=
$(BINDINC)
-I
../includes
CFLAGS
=
$(DEBUG)
$(PREDEFINES)
$(INCLUDES)
$(COPTS)
all
:
libdhcpctl.a $(CATMANPAGES)
all
:
libdhcpctl.a
test
$(CATMANPAGES)
test
:
test.o libdhcpctl.a
$(CC)
$(DEBUG)
-o
test
test.o libdhcpctl.a
test
:
test.o libdhcpctl.a
../omapip/libomapi.a
$(CC)
$(DEBUG)
-o
test
test.o libdhcpctl.a
../omapip/libomapi.a
libdhcpctl.a
:
$(OBJ)
rm
-f
libdhcpctl.a
...
...
dhcpctl/test.c
0 → 100644
View file @
d142e03f
/* test.c
Example program that uses the dhcpctl library. */
/*
* Copyright (c) 1996-1999 Internet Software Consortium.
* Use is subject to license terms which appear in the file named
* ISC-LICENSE that should have accompanied this file when you
* received it. If a file named ISC-LICENSE did not accompany this
* file, or you are not sure the one you have is correct, you may
* obtain an applicable copy of the license at:
*
* http://www.isc.org/isc-license-1.0.html.
*
* This file is part of the ISC DHCP distribution. The documentation
* associated with this file is listed in the file DOCUMENTATION,
* included in the top-level directory of this release.
*
* Support and other services are available for ISC products - see
* http://www.isc.org for more information.
*/
#include "dhcpctl.h"
int
main
(
int
,
char
**
);
int
main
(
argc
,
argv
)
int
argc
;
char
**
argv
;
{
isc_result_t
status
,
waitstatus
;
dhcpctl_handle
connection
;
dhcpctl_handle
host_handle
;
dhcpctl_data_string
cid
;
status
=
dhcpctl_initialize
();
if
(
status
!=
ISC_R_SUCCESS
)
{
fprintf
(
stderr
,
"dhcpctl_initialize: %s
\n
"
,
isc_result_totext
(
status
));
exit
(
1
);
}
memset
(
&
connection
,
0
,
sizeof
connection
);
status
=
dhcpctl_connect
(
&
connection
,
"127.0.0.1"
,
7911
,
(
dhcpctl_handle
)
0
);
if
(
status
!=
ISC_R_SUCCESS
)
{
fprintf
(
stderr
,
"dhcpctl_connect: %s
\n
"
,
isc_result_totext
(
status
));
exit
(
1
);
}
memset
(
&
host_handle
,
0
,
sizeof
host_handle
);
status
=
dhcpctl_new_object
(
&
host_handle
,
connection
,
"host"
);
if
(
status
!=
ISC_R_SUCCESS
)
{
fprintf
(
stderr
,
"dhcpctl_new_object: %s
\n
"
,
isc_result_totext
(
status
));
exit
(
1
);
}
memset
(
&
cid
,
0
,
sizeof
cid
);
status
=
omapi_data_string_new
(
&
cid
,
7
,
"main"
);
if
(
status
!=
ISC_R_SUCCESS
)
{
fprintf
(
stderr
,
"omapi_data_string_new: %s
\n
"
,
isc_result_totext
(
status
));
exit
(
1
);
}
cid
->
value
[
0
]
=
1
;
cid
->
value
[
1
]
=
8
;
cid
->
value
[
2
]
=
0
;
cid
->
value
[
3
]
=
0x2b
;
cid
->
value
[
4
]
=
0x34
;
cid
->
value
[
5
]
=
0x1a
;
cid
->
value
[
6
]
=
0xc3
;
status
=
dhcpctl_set_value
(
host_handle
,
cid
,
"dhcp-client-identifier"
);
if
(
status
!=
ISC_R_SUCCESS
)
{
fprintf
(
stderr
,
"dhcpctl_set_value: %s
\n
"
,
isc_result_totext
(
status
));
exit
(
1
);
}
/* Set the known flag to 1. */
status
=
dhcpctl_set_boolean_value
(
host_handle
,
1
,
"known"
);
if
(
status
!=
ISC_R_SUCCESS
)
{
fprintf
(
stderr
,
"dhcpctl_set_boolean_value: %s
\n
"
,
isc_result_totext
(
status
));
exit
(
1
);
}
status
=
dhcpctl_open_object
(
host_handle
,
connection
,
DHCPCTL_CREATE
|
DHCPCTL_EXCL
);
if
(
status
!=
ISC_R_SUCCESS
)
{
fprintf
(
stderr
,
"dhcpctl_open_object: %s
\n
"
,
isc_result_totext
(
status
));
exit
(
1
);
}
status
=
dhcpctl_wait_for_completion
(
host_handle
,
&
waitstatus
);
if
(
status
!=
ISC_R_SUCCESS
)
{
fprintf
(
stderr
,
"dhcpctl_wait_for_completion: %s
\n
"
,
isc_result_totext
(
status
));
exit
(
1
);
}
if
(
waitstatus
!=
ISC_R_SUCCESS
)
{
fprintf
(
stderr
,
"dhcpctl_wait_for_completion: %s
\n
"
,
isc_result_totext
(
waitstatus
));
exit
(
1
);
}
exit
(
0
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment