From: Denis Kenzior <denkenz@gmail.com>
To: ofono@lists.linux.dev
Cc: Denis Kenzior <denkenz@gmail.com>
Subject: [PATCH v2 09/14] tools: lookup-apn: add support for optional tags filter
Date: Wed, 3 Apr 2024 11:05:32 -0500 [thread overview]
Message-ID: <20240403160557.2828145-9-denkenz@gmail.com> (raw)
In-Reply-To: <20240403160557.2828145-1-denkenz@gmail.com>
---
tools/lookup-apn.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/tools/lookup-apn.c b/tools/lookup-apn.c
index abb95f38f470..e4fc79cd7819 100644
--- a/tools/lookup-apn.c
+++ b/tools/lookup-apn.c
@@ -26,7 +26,7 @@
static const char *option_file;
static int lookup_apn(const char *match_mcc, const char *match_mnc,
- const char *match_spn)
+ const char *match_spn, char **tags_filter)
{
struct provision_db *pdb;
struct provision_db_entry *contexts;
@@ -50,7 +50,8 @@ static int lookup_apn(const char *match_mcc, const char *match_mnc,
fprintf(stdout, "Searching for info for network: %s%s, spn: %s\n",
match_mcc, match_mnc, match_spn ? match_spn : "<None>");
- r = provision_db_lookup(pdb, match_mcc, match_mnc, match_spn, NULL,
+ r = provision_db_lookup(pdb, match_mcc, match_mnc,
+ match_spn, tags_filter,
&contexts, &n_contexts);
if (r < 0) {
fprintf(stderr, "Unable to lookup: %s\n", strerror(-r));
@@ -78,6 +79,8 @@ static int lookup_apn(const char *match_mcc, const char *match_mnc,
fprintf(stdout, "Message Center: %s\n",
ap->message_center);
}
+
+ fprintf(stdout, "Tags: %s\n", ap->tags);
}
l_free(contexts);
@@ -92,22 +95,26 @@ static void usage(void)
printf("lookup-apn\nUsage:\n");
printf("lookup-apn [options] <mcc> <mnc> [spn]\n");
printf("Options:\n"
- "\t-v, --version Show version\n"
- "\t-f, --file Provision DB file to use\n"
- "\t-h, --help Show help options\n");
+ "\t-v, --version Show version\n"
+ "\t-f, --file Provision DB file to use\n"
+ "\t-t, --tags Comma separated tag filter\n"
+ "\t-h, --help Show help options\n");
}
static const struct option options[] = {
{ "version", no_argument, NULL, 'v' },
{ "help", no_argument, NULL, 'h' },
{ "file", required_argument, NULL, 'f' },
+ { "tags", required_argument, NULL, 't' },
{ },
};
int main(int argc, char **argv)
{
+ _auto_(l_strv_free) char **tags_filter = NULL;
+
for (;;) {
- int opt = getopt_long(argc, argv, "f:vh", options, NULL);
+ int opt = getopt_long(argc, argv, "f:t:vh", options, NULL);
if (opt < 0)
break;
@@ -116,6 +123,9 @@ int main(int argc, char **argv)
case 'f':
option_file = optarg;
break;
+ case 't':
+ tags_filter = l_strsplit(optarg, ',');
+ break;
case 'v':
printf("%s\n", VERSION);
return EXIT_SUCCESS;
@@ -138,5 +148,6 @@ int main(int argc, char **argv)
}
return lookup_apn(argv[optind], argv[optind + 1],
- argc - optind == 3 ? argv[optind + 2] : NULL);
+ argc - optind == 3 ? argv[optind + 2] : NULL,
+ tags_filter);
}
--
2.43.0
next prev parent reply other threads:[~2024-04-03 16:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-03 16:05 [PATCH v2 01/14] simutil: Convert eons APIs to use ell Denis Kenzior
2024-04-03 16:05 ` [PATCH v2 02/14] sim: Simplify SPN management logic Denis Kenzior
2024-04-03 16:05 ` [PATCH v2 03/14] data: Remove AweSIM entry Denis Kenzior
2024-04-03 16:05 ` [PATCH v2 04/14] data: Mark some MVNOs via the "spn" attribute Denis Kenzior
2024-04-03 16:05 ` [PATCH v2 05/14] data: Remove outdated T-mobile settings Denis Kenzior
2024-04-03 16:05 ` [PATCH v2 06/14] data: Remove RESELLER settings from AT&T Denis Kenzior
2024-04-03 16:05 ` [PATCH v2 07/14] provisiontool: Add support for context tags Denis Kenzior
2024-04-03 16:05 ` [PATCH v2 08/14] provisiondb: Add tags_filter support Denis Kenzior
2024-04-03 16:05 ` Denis Kenzior [this message]
2024-04-03 16:05 ` [PATCH v2 10/14] data: Add tags for AT&T and T-Mobile contexts Denis Kenzior
2024-04-03 16:05 ` [PATCH v2 11/14] ofono: Add support for ofono main.conf settings Denis Kenzior
2024-04-03 16:05 ` [PATCH v2 12/14] provision: Add support for provision filter tags Denis Kenzior
2024-04-03 16:05 ` [PATCH v2 13/14] examples: Fix use after free and resource leaks Denis Kenzior
2024-04-03 16:05 ` [PATCH v2 14/14] unit: Add test cases with tags_filter provided Denis Kenzior
2024-04-03 17:00 ` [PATCH v2 01/14] simutil: Convert eons APIs to use ell patchwork-bot+ofono
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240403160557.2828145-9-denkenz@gmail.com \
--to=denkenz@gmail.com \
--cc=ofono@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.