Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libloc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
nexedi
libloc
Commits
9268db5a
Commit
9268db5a
authored
Oct 13, 2019
by
Michael Tremer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement searching for networks with a certain flag
Signed-off-by:
Michael Tremer
<
michael.tremer@ipfire.org
>
parent
a293f829
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
src/database.c
src/database.c
+15
-0
src/loc/database.h
src/loc/database.h
+1
-0
No files found.
src/database.c
View file @
9268db5a
...
...
@@ -80,6 +80,7 @@ struct loc_database_enumerator {
char
*
string
;
char
country_code
[
3
];
uint32_t
asn
;
enum
loc_network_flags
flags
;
// Index of the AS we are looking at
unsigned
int
as_index
;
...
...
@@ -662,6 +663,13 @@ LOC_EXPORT int loc_database_enumerator_set_asn(
return
0
;
}
LOC_EXPORT
int
loc_database_enumerator_set_flag
(
struct
loc_database_enumerator
*
enumerator
,
enum
loc_network_flags
flag
)
{
enumerator
->
flags
|=
flag
;
return
0
;
}
LOC_EXPORT
int
loc_database_enumerator_next_as
(
struct
loc_database_enumerator
*
enumerator
,
struct
loc_as
**
as
)
{
*
as
=
NULL
;
...
...
@@ -807,6 +815,13 @@ LOC_EXPORT int loc_database_enumerator_next_network(
continue
;
}
// Skip if flags do not match
if
(
enumerator
->
flags
&&
!
loc_network_match_flag
(
*
network
,
enumerator
->
flags
))
{
loc_network_unref
(
*
network
);
*
network
=
NULL
;
}
return
0
;
}
}
...
...
src/loc/database.h
View file @
9268db5a
...
...
@@ -57,6 +57,7 @@ struct loc_database_enumerator* loc_database_enumerator_unref(struct loc_databas
int
loc_database_enumerator_set_string
(
struct
loc_database_enumerator
*
enumerator
,
const
char
*
string
);
int
loc_database_enumerator_set_country_code
(
struct
loc_database_enumerator
*
enumerator
,
const
char
*
country_code
);
int
loc_database_enumerator_set_asn
(
struct
loc_database_enumerator
*
enumerator
,
unsigned
int
asn
);
int
loc_database_enumerator_set_flag
(
struct
loc_database_enumerator
*
enumerator
,
enum
loc_network_flags
flag
);
int
loc_database_enumerator_next_as
(
struct
loc_database_enumerator
*
enumerator
,
struct
loc_as
**
as
);
int
loc_database_enumerator_next_network
(
...
...
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