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
c918d55e
Commit
c918d55e
authored
7 years ago
by
Jakob Olsson
Browse files
Options
Downloads
Patches
Plain Diff
common.h: add documentation
parent
5548f666
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common.h
+60
-10
60 additions, 10 deletions
common.h
with
60 additions
and
10 deletions
common.h
+
60
−
10
View file @
c918d55e
...
@@ -27,7 +27,6 @@
...
@@ -27,7 +27,6 @@
extern
int
debug
;
extern
int
debug
;
extern
struct
device
*
global_dev
;
extern
struct
device
*
global_dev
;
extern
struct
ubus_context
*
global_ctx
;
#define debug_print(...) \
#define debug_print(...) \
do { \
do { \
...
@@ -35,15 +34,6 @@ extern struct ubus_context *global_ctx;
...
@@ -35,15 +34,6 @@ extern struct ubus_context *global_ctx;
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, __VA_ARGS__); \
} while (0)
} while (0)
#define TAG_CONTENT_SIZE 100
struct
write_result
{
char
*
data
;
int
pos
;
};
char
*
get_ip
(
char
*
if_name
);
char
*
get_ip
(
char
*
if_name
);
/**
/**
* Function: print_to_ubus
* Function: print_to_ubus
...
@@ -89,6 +79,19 @@ struct json_object *xml_to_json_converter(struct write_result *result);
...
@@ -89,6 +79,19 @@ struct json_object *xml_to_json_converter(struct write_result *result);
* false if the string contains any non-digit character.
* false if the string contains any non-digit character.
*/
*/
int
isdigits
(
const
char
*
str
);
int
isdigits
(
const
char
*
str
);
/**
* Function: validate_puk_format
*
* Checks whether a given PUK code is of valid format or not.
*
* Parameters:
* puk - the string to check for structure validity
*
* Returns:
* 0 if the string is of valid format.
* -1 on invalid format.
*/
int
validate_puk_format
(
char
*
puk
);
int
validate_puk_format
(
char
*
puk
);
/**
/**
...
@@ -104,7 +107,54 @@ int validate_puk_format(char *puk);
...
@@ -104,7 +107,54 @@ int validate_puk_format(char *puk);
* -1 on invalid format.
* -1 on invalid format.
*/
*/
int
validate_pin_format
(
char
*
pin
);
int
validate_pin_format
(
char
*
pin
);
/**
* Function: pin_status
*
* Provides an error response to be used to print a message if the call fails
* due to pin being disabled. Up to the caller whether the print this message or
* not (depending on the necessity of pin to be disabled or enabled for the feature).
*
* Parameters:
* bb - pointer to the buff.
* dev - the device containing the currently active device.
*
* Returns:
* 0 if the string is of valid format.
* -1 on invalid format.
*/
int
pin_status
(
struct
blob_buf
*
bb
,
struct
device
*
dev
);
int
pin_status
(
struct
blob_buf
*
bb
,
struct
device
*
dev
);
/**
* Function: check_response
*
* Determines whether the dongle API response was successful or not. Requires the
* response to be in the format of {"result": "success"} or {"result": "failure"}.
*
* Parameters:
* response - the json response to parse for success or failure.
*
* Returns:
* 0 if the response contained success.
* -1 if the response contained failure.
*/
int
check_response
(
struct
json_object
*
response
);
int
check_response
(
struct
json_object
*
response
);
struct
json_object
*
get_json_string_object_by_key
(
json_object
*
json_obj
,
char
*
string
);
struct
json_object
*
get_json_string_object_by_key
(
json_object
*
json_obj
,
char
*
string
);
/**
* Function: remove_newline
*
* Replaces the first newline character ('\n') found by a null-terminating byte ('\0').
*
* Parameters:
* response - the json response to parse for success or failure.
*
* Returns:
* 0 if the response contained success.
* -1 if the response contained failure.
*
* IMPORTANT NOTE
* Will alter the input string!
*/
void
remove_newline
(
char
*
input
);
#endif
#endif
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