Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
multipass
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
derf
multipass
Commits
a1bbc3b6
Commit
a1bbc3b6
authored
6 years ago
by
Birte Kristina Friesel
Browse files
Options
Downloads
Patches
Plain Diff
add preliminary xdr input driver
parent
5471509e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/object/xdrinput.h
+22
-0
22 additions, 0 deletions
include/object/xdrinput.h
src/os/object/xdrinput.cc
+51
-0
51 additions, 0 deletions
src/os/object/xdrinput.cc
with
73 additions
and
0 deletions
include/object/xdrinput.h
0 → 100644
+
22
−
0
View file @
a1bbc3b6
#ifndef XDRINPUT_H
#define XDRINPUT_H
#include
<stdint.h>
class
XDRInput
{
private:
XDRInput
(
const
XDRInput
&
copy
);
char
*
data
;
uint32_t
pos
;
public:
XDRInput
(
char
*
d
)
:
pos
(
0
)
{
data
=
d
;
}
uint32_t
get_uint32
();
int32_t
get_int32
();
uint64_t
get_uint64
();
int64_t
get_int64
();
uint32_t
get_opaque_length
();
char
*
get_opaque
(
uint32_t
length
);
};
#endif
This diff is collapsed.
Click to expand it.
src/os/object/xdrinput.cc
0 → 100644
+
51
−
0
View file @
a1bbc3b6
#include
"object/xdrinput.h"
uint32_t
XDRInput
::
get_uint32
()
{
uint32_t
ret
=
((
uint8_t
)
data
[
pos
]
<<
24
)
|
((
uint8_t
)
data
[
pos
+
1
]
<<
16
)
|
((
uint8_t
)
data
[
pos
+
2
]
<<
8
)
|
(
uint8_t
)
data
[
pos
+
3
];
pos
+=
4
;
return
ret
;
}
int32_t
XDRInput
::
get_int32
()
{
int32_t
ret
=
(
data
[
pos
]
<<
24
)
|
(
data
[
pos
+
1
]
<<
16
)
|
(
data
[
pos
+
2
]
<<
8
)
|
data
[
pos
+
3
];
pos
+=
4
;
return
ret
;
}
uint64_t
XDRInput
::
get_uint64
()
{
uint64_t
ret0
=
((
uint8_t
)
data
[
pos
]
<<
24
)
|
((
uint8_t
)
data
[
pos
+
1
]
<<
16
)
|
((
uint8_t
)
data
[
pos
+
2
]
<<
8
)
|
(
uint8_t
)
data
[
pos
+
3
];
pos
+=
4
;
uint64_t
ret1
=
((
uint8_t
)
data
[
pos
]
<<
24
)
|
((
uint8_t
)
data
[
pos
+
1
]
<<
16
)
|
((
uint8_t
)
data
[
pos
+
2
]
<<
8
)
|
(
uint8_t
)
data
[
pos
+
3
];
pos
+=
4
;
return
(
ret0
<<
32
)
|
ret1
;
}
int64_t
XDRInput
::
get_int64
()
{
int64_t
ret0
=
(
data
[
pos
]
<<
24
)
|
(
data
[
pos
+
1
]
<<
16
)
|
(
data
[
pos
+
2
]
<<
8
)
|
data
[
pos
+
3
];
pos
+=
4
;
int64_t
ret1
=
(
data
[
pos
]
<<
24
)
|
(
data
[
pos
+
1
]
<<
16
)
|
(
data
[
pos
+
2
]
<<
8
)
|
data
[
pos
+
3
];
pos
+=
4
;
return
(
ret0
<<
32
)
|
ret1
;
}
uint32_t
XDRInput
::
get_opaque_length
()
{
return
get_uint32
();
}
char
*
XDRInput
::
get_opaque
(
uint32_t
length
)
{
char
*
ret
=
data
+
pos
;
pos
+=
length
;
if
(
length
%
4
)
{
pos
+=
4
-
(
length
%
4
);
}
return
ret
;
}
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