Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
LabComm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tommy Olofsson
LabComm
Commits
b33c526b
Commit
b33c526b
authored
Apr 15, 2013
by
Sven Robertz
Browse files
Options
Downloads
Patches
Plain Diff
changed name to cached_encoded_size for clarity + started to move parser towards using signature_t
parent
7bc4e7a1
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/c/experimental/labcomm_sig_parser.c
+22
-17
22 additions, 17 deletions
lib/c/experimental/labcomm_sig_parser.c
lib/c/labcomm.h
+1
-1
1 addition, 1 deletion
lib/c/labcomm.h
with
23 additions
and
18 deletions
lib/c/experimental/labcomm_sig_parser.c
+
22
−
17
View file @
b33c526b
...
@@ -165,30 +165,35 @@ void getStr(buffer *b, char *dest, size_t size) {
...
@@ -165,30 +165,35 @@ void getStr(buffer *b, char *dest, size_t size) {
b
->
idx
+=
size
;
b
->
idx
+=
size
;
}
}
labcomm_signature_t
sig_ts
[
MAX_SIGNATURES
];
unsigned
int
signatures_length
[
MAX_SIGNATURES
];
unsigned
int
signatures_length
[
MAX_SIGNATURES
];
unsigned
int
signatures_name_length
[
MAX_SIGNATURES
];
unsigned
int
signatures_name_length
[
MAX_SIGNATURES
];
unsigned
char
signatures_name
[
MAX_SIGNATURES
][
MAX_NAME_LEN
];
//HERE BE DRAGONS: add range checks
unsigned
char
signatures_name
[
MAX_SIGNATURES
][
MAX_NAME_LEN
];
//HERE BE DRAGONS: add range checks
unsigned
char
signatures
[
MAX_SIGNATURES
][
MAX_SIG_LEN
];
unsigned
char
signatures
[
MAX_SIGNATURES
][
MAX_SIG_LEN
];
unsigned
int
get_signature_len
(
unsigned
int
uid
){
labcomm_signature_t
*
get_sig_t
(
unsigned
int
uid
)
return
signatures_length
[
uid
-
LABCOMM_USER
];
{
}
return
&
sig_ts
[
uid
-
LABCOMM_USER
];
unsigned
char
*
get_signature
(
unsigned
int
uid
){
return
signatures
[
uid
-
LABCOMM_USER
];
}
}
unsigned
int
get_signature_name_len
(
unsigned
int
uid
){
unsigned
int
get_signature_len
(
unsigned
int
uid
){
return
signatures_name_length
[
uid
-
LABCOMM_USER
];
//return signatures_length[uid-LABCOMM_USER];
return
sig_ts
[
uid
-
LABCOMM_USER
].
size
;
}
}
unsigned
char
*
get_signature_name
(
unsigned
int
uid
){
unsigned
char
*
get_signature
(
unsigned
int
uid
){
return
signatures_name
[
uid
-
LABCOMM_USER
];
//return signatures[uid-LABCOMM_USER];
return
sig_ts
[
uid
-
LABCOMM_USER
].
signature
;
}
}
labcomm_signature_t
sig_ts
[
MAX_SIGNATURES
];
//is this needed?
//unsigned int get_signature_name_len(unsigned int uid){
// return signatures_name_length[uid-LABCOMM_USER];
//}
labcomm_signature_t
*
get_sig_t
(
unsigned
int
uid
)
unsigned
char
*
get_signature_name
(
unsigned
int
uid
)
{
{
//return signatures_name[uid-LABCOMM_USER];
return
&
sig_ts
[
uid
-
LABCOMM_USER
];
return
sig_ts
[
uid
-
LABCOMM_USER
]
.
name
;
}
}
void
dump_signature
(
unsigned
int
uid
){
void
dump_signature
(
unsigned
int
uid
){
...
@@ -269,10 +274,10 @@ static unsigned char labcomm_varint_sizeof(unsigned int i)
...
@@ -269,10 +274,10 @@ static unsigned char labcomm_varint_sizeof(unsigned int i)
int
encoded_size_static
(
labcomm_signature_t
*
sig
,
void
*
unused
)
int
encoded_size_static
(
labcomm_signature_t
*
sig
,
void
*
unused
)
{
{
if
(
sig
->
cached_size
==
-
1
)
{
if
(
sig
->
cached_
encoded_
size
==
-
1
)
{
error
(
"encoded_size_static called for var_size sample or uninitialized signature
\n
"
);
error
(
"encoded_size_static called for var_size sample or uninitialized signature
\n
"
);
}
}
return
sig
->
cached_size
;
return
sig
->
cached_
encoded_
size
;
}
}
/* This function probably never will be implemented, as it would be
/* This function probably never will be implemented, as it would be
...
@@ -356,11 +361,11 @@ int do_parse(buffer *d) {
...
@@ -356,11 +361,11 @@ int do_parse(buffer *d) {
VERBOSE_PRINTF
(
"signature for uid %x: %s (start=%x,end=%x, nlen=%d,len=%d)
\n
"
,
uid
,
get_signature_name
(
uid
),
start
,
end
,
nlen
,
len
);
VERBOSE_PRINTF
(
"signature for uid %x: %s (start=%x,end=%x, nlen=%d,len=%d)
\n
"
,
uid
,
get_signature_name
(
uid
),
start
,
end
,
nlen
,
len
);
INFO_PRINTF
(
"SIG: %s
\n
"
,
newsig
->
name
);
INFO_PRINTF
(
"SIG: %s
\n
"
,
newsig
->
name
);
if
(
!
d
->
current_decl_is_varsize
)
{
if
(
!
d
->
current_decl_is_varsize
)
{
newsig
->
cached_size
=
enc_size
;
newsig
->
cached_
encoded_
size
=
enc_size
;
newsig
->
encoded_size
=
encoded_size_static
;
newsig
->
encoded_size
=
encoded_size_static
;
INFO_PRINTF
(
".... is static size = %d
\n
"
,
enc_size
);
INFO_PRINTF
(
".... is static size = %d
\n
"
,
enc_size
);
}
else
{
}
else
{
newsig
->
cached_size
=
-
1
;
newsig
->
cached_
encoded_
size
=
-
1
;
newsig
->
encoded_size
=
encoded_size_parse_sig
;
newsig
->
encoded_size
=
encoded_size_parse_sig
;
INFO_PRINTF
(
".... is variable size
\n
"
);
INFO_PRINTF
(
".... is variable size
\n
"
);
}
}
...
...
This diff is collapsed.
Click to expand it.
lib/c/labcomm.h
+
1
−
1
View file @
b33c526b
...
@@ -29,7 +29,7 @@ typedef struct labcomm_signature{
...
@@ -29,7 +29,7 @@ typedef struct labcomm_signature{
int
(
*
encoded_size
)(
struct
labcomm_signature
*
,
void
*
);
// void * == encoded_sample *
int
(
*
encoded_size
)(
struct
labcomm_signature
*
,
void
*
);
// void * == encoded_sample *
int
size
;
int
size
;
unsigned
char
*
signature
;
unsigned
char
*
signature
;
int
cached_size
;
// -1 if not initialized or type is variable size
int
cached_
encoded_
size
;
// -1 if not initialized or type is variable size
}
labcomm_signature_t
;
}
labcomm_signature_t
;
/*
/*
...
...
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