Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OAI-RAN-5G-sheduler_MaxTBS
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
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MAQ5G-PFC
OAI-RAN-5G-sheduler_MaxTBS
Commits
4b68033b
Commit
4b68033b
authored
9 years ago
by
Cedric Roux
Browse files
Options
Downloads
Patches
Plain Diff
some work for buffer handling
parent
1e20abdd
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
T.h
+7
-5
7 additions, 5 deletions
T.h
T_messages.txt
+1
-0
1 addition, 0 deletions
T_messages.txt
main.c
+4
-2
4 additions, 2 deletions
main.c
tracer/main.c
+11
-2
11 additions, 2 deletions
tracer/main.c
with
23 additions
and
9 deletions
T.h
+
7
−
5
View file @
4b68033b
...
...
@@ -36,10 +36,12 @@
#define T_PUT_buffer(argnum, val) \
do { \
T_buffer T_PUT_var = (val); \
T_CHECK_SIZE(T_PUT_var.length, argnum); \
memcpy(T_LOCAL_buf + T_LOCAL_size, T_PUT_var.addr, T_PUT_var.length); \
T_LOCAL_size += T_PUT_var.length; \
T_buffer T_PUT_buffer_var = (val); \
T_PUT_int(argnum, T_PUT_buffer_var.length); \
T_CHECK_SIZE(T_PUT_buffer_var.length, argnum); \
memcpy(T_LOCAL_buf + T_LOCAL_size, T_PUT_buffer_var.addr, \
T_PUT_buffer_var.length); \
T_LOCAL_size += T_PUT_buffer_var.length; \
} while (0)
#define T_PUT_string(argnum, val) \
...
...
@@ -117,7 +119,7 @@ extern T_cache_t *T_cache;
T_send(T_LOCAL_buf, T_LOCAL_size)
#define T_CHECK_SIZE(len, argnum) \
if (T_LOCAL_size + len > T_BUFFER_MAX) { \
if (T_LOCAL_size +
(
len
)
> T_BUFFER_MAX) { \
printf("%s:%d:%s: cannot put argument %d in T macro, not enough space" \
", consider increasing T_BUFFER_MAX (%d)\n", \
__FILE__, __LINE__, __FUNCTION__, argnum, T_BUFFER_MAX); \
...
...
This diff is collapsed.
Click to expand it.
T_messages.txt
+
1
−
0
View file @
4b68033b
...
...
@@ -138,3 +138,4 @@ ID = LEGACY_CLI_DEBUG
ID = LEGACY_CLI_TRACE
ID = first
ID = buf_test
This diff is collapsed.
Click to expand it.
main.c
+
4
−
2
View file @
4b68033b
...
...
@@ -10,8 +10,10 @@ int main(void)
T_connect_to_tracer
(
"127.0.0.1"
,
2020
);
printf
(
"after connect
\n
"
);
while
(
1
)
{
T
(
T_first
,
T_PRINTF
(
"hello world %s!
\n
"
,
"yo"
));
//usleep(1);
char
*
buf
=
"hello world %s!
\n
"
;
//T(T_first, T_PRINTF("hello world %s!\n", "yo"));
T
(
T_buf_test
,
T_BUFFER
(
"hello world %s!
\n
"
,
strlen
(
buf
)
+
1
));
usleep
(
1
);
}
while
(
1
)
pause
();
...
...
This diff is collapsed.
Click to expand it.
tracer/main.c
+
11
−
2
View file @
4b68033b
...
...
@@ -73,7 +73,7 @@ void get_string(int s, char *out)
void
get_message
(
int
s
)
{
#define S(x, y) do { \
char str[
1024
]; \
char str[
T_BUFFER_MAX
]; \
get_string(s, str); \
printf("["x"]["y"] %s", str); \
} while (0)
...
...
@@ -85,7 +85,7 @@ void get_message(int s)
if
(
GET
(
s
,
&
m
,
sizeof
(
int
))
!=
sizeof
(
int
))
abort
();
switch
(
m
)
{
case
T_first
:
{
char
str
[
1024
];
char
str
[
T_BUFFER_MAX
];
get_string
(
s
,
str
);
printf
(
"%s"
,
str
);
break
;
...
...
@@ -195,6 +195,15 @@ void get_message(int s)
case
T_LEGACY_CLI_WARNING
:
S
(
"CLI"
,
"WARNING"
);
break
;
case
T_LEGACY_CLI_DEBUG
:
S
(
"CLI"
,
"DEBUG"
);
break
;
case
T_LEGACY_CLI_TRACE
:
S
(
"CLI"
,
"TRACE"
);
break
;
case
T_buf_test
:
{
unsigned
char
buf
[
T_BUFFER_MAX
];
int
size
;
GET
(
s
,
&
size
,
sizeof
(
int
));
GET
(
s
,
buf
,
size
);
printf
(
"got buffer size %d %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x
\n
"
,
size
,
buf
[
0
],
buf
[
1
],
buf
[
2
],
buf
[
3
],
buf
[
4
],
buf
[
5
],
buf
[
6
],
buf
[
7
],
buf
[
8
],
buf
[
9
],
buf
[
10
],
buf
[
11
],
buf
[
12
],
buf
[
13
],
buf
[
14
],
buf
[
15
]);
break
;
}
default:
printf
(
"unkown message type %d
\n
"
,
m
);
abort
();
}
...
...
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