Skip to content

Commit

Permalink
unix: add icons handling
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Lehner <[email protected]>
  • Loading branch information
florianl committed Jun 8, 2024
1 parent 27c6883 commit 4d3c934
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ type UnixAttribute struct {
Shutdown *uint8
UID *uint32
Peer *uint32
Icons []uint32
}

// Based on inet_diag_sockopt
Expand Down
4 changes: 3 additions & 1 deletion unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ func extractUnixAttributes(data []byte, info *UnixAttribute) error {
case unixDiagIcons:
tmp := ad.Bytes()
numIcons := len(tmp) / 4
icons := make([]uint32, 0, numIcons)
for i := 0; i < numIcons; i++ {
fmt.Printf("icon: %d\t%d\n", i, binary.LittleEndian.Uint32(tmp[i*4:(i+1)*4]))
icons = append(icons, binary.LittleEndian.Uint32(tmp[i*4:(i+1)*4]))
}
info.Icons = icons
case unixDiagRQLen:
rqlen := &UnixDiagRqLen{}
err := unmarshalStruct(ad.Bytes(), rqlen)
Expand Down

0 comments on commit 4d3c934

Please sign in to comment.