Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mdmngr
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
IOPSYS
mdmngr
Commits
e49e684f
Commit
e49e684f
authored
7 years ago
by
Jakob Olsson
Browse files
Options
Downloads
Patches
Plain Diff
parse input apn profile to json, replace strtok with strsep for does not work with empty signs
parent
e8c5ac4e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
common.c
+10
-4
10 additions, 4 deletions
common.c
common.h
+2
-1
2 additions, 1 deletion
common.h
dongle_apn.c
+5
-2
5 additions, 2 deletions
dongle_apn.c
with
17 additions
and
7 deletions
common.c
+
10
−
4
View file @
e49e684f
...
...
@@ -24,11 +24,16 @@ fail:
int
write_to_ubus
(
struct
json_object
*
parsed_response
,
struct
ubus_context
*
ctx
,
struct
ubus_request_data
*
req
)
{
struct
blob_buf
bb
;
printf
(
"här kan man va
\n
"
);
memset
(
&
bb
,
0
,
sizeof
(
struct
blob_buf
));
printf
(
"här kan man va
\n
"
);
blob_buf_init
(
&
bb
,
0
);
printf
(
"här kan man va
\n
"
);
printf
(
"och här!
\n
"
);
bb
=
json_to_blob
(
parsed_response
,
bb
);
printf
(
"här kan man va
\n
"
);
ubus_send_reply
(
ctx
,
req
,
bb
.
head
);
printf
(
"här kan man va
\n
"
);
blob_buf_free
(
&
bb
);
//json_object_put(parsed_response);
return
0
;
...
...
@@ -36,12 +41,13 @@ int write_to_ubus(struct json_object *parsed_response, struct ubus_context *ctx,
struct
blob_buf
json_to_blob
(
struct
json_object
*
response
,
struct
blob_buf
bb
)
{
printf
(
"och här!
\n
"
);
void
*
arr
,
*
obj
;
int
i
;
printf
(
"och här!
\n
"
);
json_object_object_foreach
(
response
,
key
,
val
)
{
int
val_type
=
json_object_get_type
(
val
);
printf
(
"och här!
\n
"
);
switch
(
val_type
)
{
case
json_type_int
:
blobmsg_add_u32
(
&
bb
,
key
,
json_object_get_int
(
val
));
...
...
@@ -67,4 +73,4 @@ struct blob_buf json_to_blob(struct json_object *response, struct blob_buf bb)
}
return
bb
;
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
common.h
+
2
−
1
View file @
e49e684f
...
...
@@ -6,7 +6,8 @@
fprintf(stdout, "\n(DEBUG)\t"); \
fprintf(stdout, message, ##__VA_ARGS__);\
} while (0)
#include
"libtrace.h"
#include
<libmobile.h>
#include
<json-c/json.h>
#include
<string.h>
#include
<libubox/blobmsg.h>
...
...
This diff is collapsed.
Click to expand it.
dongle_apn.c
+
5
−
2
View file @
e49e684f
...
...
@@ -12,7 +12,6 @@
#include
<libubox/list.h>
#include
"libmobile.h"
#include
"common.h"
struct
ubus_context
*
ctx
;
...
...
@@ -31,8 +30,12 @@ int list_apn_profiles(struct ubus_context *ctx, struct ubus_object *obj,
struct
blob_attr
*
msg
)
{
char
*
response
=
mobile_get_apn_profiles
();
struct
json_object
*
parsed_response
=
parse_apn_profiles
(
response
);
return
parse_and_print
(
response
,
ctx
,
req
);
printf
(
"here we are once again my old friend!
\n
"
);
write_to_ubus
(
parsed_response
,
ctx
,
req
);
return
0
;
//return parse_and_print(response, ctx, req);
}
int
delete_apn_profile
(
struct
ubus_context
*
ctx
,
struct
ubus_object
*
obj
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment