Skip to content

Commit

Permalink
pyrdp: Reorganize pdu consts a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
wader committed Jun 16, 2024
1 parent a38a903 commit c462db6
Showing 1 changed file with 35 additions and 33 deletions.
68 changes: 35 additions & 33 deletions format/pyrdp/pdu/clipboard_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,50 @@ import (

const (
// Message types.
CB_MONITOR_READY = 0x0001
CB_FORMAT_LIST = 0x0002
CB_FORMAT_LIST_RESPONSE = 0x0003
CB_FORMAT_DATA_REQUEST = 0x0004
CB_FORMAT_DATA_RESPONSE = 0x0005
CB_TEMP_DIRECTORY = 0x0006
CB_CLIP_CAPS = 0x0007
CB_FILECONTENTS_REQUEST = 0x0008
CB_FILECONTENTS_RESPONSE = 0x0009
CB_LOCK_CLIPDATA = 0x000a
CB_UNLOCK_CLIPDATA = 0x000b

// Message flags.
NONE = 0
CB_RESPONSE_OK = 0x0001
CB_RESPONSE_FAIL = 0x0002
CB_ASCII_NAMES = 0x0004
CB_TYPE_MONITOR_READY = 0x0001
CB_TYPE_FORMAT_LIST = 0x0002
CB_TYPE_FORMAT_LIST_RESPONSE = 0x0003
CB_TYPE_FORMAT_DATA_REQUEST = 0x0004
CB_TYPE_FORMAT_DATA_RESPONSE = 0x0005
CB_TYPE_TEMP_DIRECTORY = 0x0006
CB_TYPE_CLIP_CAPS = 0x0007
CB_TYPE_FILECONTENTS_REQUEST = 0x0008
CB_TYPE_FILECONTENTS_RESPONSE = 0x0009
CB_TYPE_LOCK_CLIPDATA = 0x000a
CB_TYPE_UNLOCK_CLIPDATA = 0x000b
)

var cbTypesMap = scalar.UintMapSymStr{
CB_MONITOR_READY: "monitor_ready",
CB_FORMAT_LIST: "format_list",
CB_FORMAT_LIST_RESPONSE: "format_list_response",
CB_FORMAT_DATA_REQUEST: "format_data_request",
CB_FORMAT_DATA_RESPONSE: "format_data_response",
CB_TEMP_DIRECTORY: "temp_directory",
CB_CLIP_CAPS: "clip_caps",
CB_FILECONTENTS_REQUEST: "filecontents_request",
CB_FILECONTENTS_RESPONSE: "filecontents_response",
CB_LOCK_CLIPDATA: "lock_clipdata",
CB_UNLOCK_CLIPDATA: "unlock_clipdata",
CB_TYPE_MONITOR_READY: "monitor_ready",
CB_TYPE_FORMAT_LIST: "format_list",
CB_TYPE_FORMAT_LIST_RESPONSE: "format_list_response",
CB_TYPE_FORMAT_DATA_REQUEST: "format_data_request",
CB_TYPE_FORMAT_DATA_RESPONSE: "format_data_response",
CB_TYPE_TEMP_DIRECTORY: "temp_directory",
CB_TYPE_CLIP_CAPS: "clip_caps",
CB_TYPE_FILECONTENTS_REQUEST: "filecontents_request",
CB_TYPE_FILECONTENTS_RESPONSE: "filecontents_response",
CB_TYPE_LOCK_CLIPDATA: "lock_clipdata",
CB_TYPE_UNLOCK_CLIPDATA: "unlock_clipdata",
}

const (
// Message flags.
CB_FLAG_NONE = 0
CB_FLAG_RESPONSE_OK = 0x0001
CB_FLAG_RESPONSE_FAIL = 0x0002
CB_FLAG_ASCII_NAMES = 0x0004
)

var cbFlagsMap = scalar.UintMapSymStr{
NONE: "none",
CB_RESPONSE_OK: "response_ok",
CB_RESPONSE_FAIL: "response_fail",
CB_ASCII_NAMES: "ascii_names",
CB_FLAG_NONE: "none",
CB_FLAG_RESPONSE_OK: "response_ok",
CB_FLAG_RESPONSE_FAIL: "response_fail",
CB_FLAG_ASCII_NAMES: "ascii_names",
}

var cbParseFnMap = map[uint16]interface{}{
CB_FORMAT_DATA_RESPONSE: parseCbFormatDataResponse,
CB_TYPE_FORMAT_DATA_RESPONSE: parseCbFormatDataResponse,
}

func parseClipboardData(d *decode.D, length int64) {
Expand Down

0 comments on commit c462db6

Please sign in to comment.