Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Goshimmer_without_tipselection
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
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
COLLET Ismael
Goshimmer_without_tipselection
Commits
addd9a2b
Unverified
Commit
addd9a2b
authored
5 years ago
by
Levente Pap
Browse files
Options
Downloads
Patches
Plain Diff
Add message registry for analysis packet types
parent
293044f9
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
plugins/analysis/packet/heartbeat.go
+0
-6
0 additions, 6 deletions
plugins/analysis/packet/heartbeat.go
plugins/analysis/packet/packet.go
+22
-1
22 additions, 1 deletion
plugins/analysis/packet/packet.go
plugins/analysis/server/plugin.go
+1
-1
1 addition, 1 deletion
plugins/analysis/server/plugin.go
with
23 additions
and
8 deletions
plugins/analysis/packet/heartbeat.go
+
0
−
6
View file @
addd9a2b
...
@@ -62,12 +62,6 @@ type Heartbeat struct {
...
@@ -62,12 +62,6 @@ type Heartbeat struct {
InboundIDs
[][]
byte
InboundIDs
[][]
byte
}
}
func
init
()
{
if
err
:=
message
.
RegisterType
(
MessageTypeHeartbeat
,
HeartbeatMessageDefinition
);
err
!=
nil
{
panic
(
err
)
}
}
// ParseHeartbeat parses a slice of bytes (serialized packet) into a heartbeat.
// ParseHeartbeat parses a slice of bytes (serialized packet) into a heartbeat.
func
ParseHeartbeat
(
data
[]
byte
)
(
*
Heartbeat
,
error
)
{
func
ParseHeartbeat
(
data
[]
byte
)
(
*
Heartbeat
,
error
)
{
// check minimum size
// check minimum size
...
...
This diff is collapsed.
Click to expand it.
plugins/analysis/packet/packet.go
+
22
−
1
View file @
addd9a2b
package
packet
package
packet
import
"errors"
import
(
"errors"
"github.com/iotaledger/hive.go/protocol/message"
"github.com/iotaledger/hive.go/protocol/tlv"
)
var
(
var
(
// ErrMalformedPacket is returned when malformed packets are tried to be parsed.
// ErrMalformedPacket is returned when malformed packets are tried to be parsed.
ErrMalformedPacket
=
errors
.
New
(
"malformed packet"
)
ErrMalformedPacket
=
errors
.
New
(
"malformed packet"
)
)
)
// AnalysisMsgRegistry holds all message definitions for analysis server related messages
var
AnalysisMsgRegistry
*
message
.
Registry
func
init
()
{
AnalysisMsgRegistry
=
message
.
NewRegistry
()
// register tlv header type
if
err
:=
AnalysisMsgRegistry
.
RegisterType
(
tlv
.
MessageTypeHeader
,
tlv
.
HeaderMessageDefinition
);
err
!=
nil
{
panic
(
err
)
}
// analysis plugin specific types (msgType > 0)
if
err
:=
AnalysisMsgRegistry
.
RegisterType
(
MessageTypeHeartbeat
,
HeartbeatMessageDefinition
);
err
!=
nil
{
panic
(
err
)
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
plugins/analysis/server/plugin.go
+
1
−
1
View file @
addd9a2b
...
@@ -81,7 +81,7 @@ func HandleConnection(conn *network.ManagedConnection) {
...
@@ -81,7 +81,7 @@ func HandleConnection(conn *network.ManagedConnection) {
}
}
// create new protocol instance
// create new protocol instance
p
:=
protocol
.
New
(
conn
)
p
:=
protocol
.
New
(
conn
,
packet
.
AnalysisMsgRegistry
)
onReceiveData
:=
events
.
NewClosure
(
func
(
data
[]
byte
)
{
onReceiveData
:=
events
.
NewClosure
(
func
(
data
[]
byte
)
{
// process incoming data in protocol.Receive()
// process incoming data in protocol.Receive()
...
...
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