MCPcopy
hub / github.com/shadow1ng/fscan / recvData

Method recvData

mylib/grdp/protocol/t125/mcs.go:439–485  ·  view source on GitHub ↗
(s []byte)

Source from the content-addressed store, hash-verified

437}
438
439func (c *MCSClient) recvData(s []byte) {
440 glog.Debug("msc on data recvData:", hex.EncodeToString(s))
441
442 r := bytes.NewReader(s)
443 option, err := core.ReadUInt8(r)
444 if err != nil {
445 c.Emit("error", err)
446 return
447 }
448
449 if readMCSPDUHeader(option, DISCONNECT_PROVIDER_ULTIMATUM) {
450 c.Emit("error", errors.New("MCS DISCONNECT_PROVIDER_ULTIMATUM"))
451 c.transport.Close()
452 return
453 } else if !readMCSPDUHeader(option, c.recvOpCode) {
454 c.Emit("error", errors.New("Invalid expected MCS opcode receive data"))
455 return
456 }
457
458 userId, _ := per.ReadInteger16(r)
459 userId += MCS_USERCHANNEL_BASE
460
461 channelId, _ := per.ReadInteger16(r)
462 per.ReadEnumerates(r)
463 size, _ := per.ReadLength(r)
464 // channel ID doesn't match a requested layer
465 found := false
466 channelName := ""
467 for _, channel := range c.channels {
468 if channel.ID == channelId {
469 found = true
470 channelName = channel.Name
471 break
472 }
473 }
474 if !found {
475 glog.Error("mcs receive data for an unconnected layer")
476 return
477 }
478 left, err := core.ReadBytes(int(size), r)
479 if err != nil {
480 c.Emit("error", errors.New(fmt.Sprintf("mcs recvData get data error %v", err)))
481 return
482 }
483 glog.Debugf("mcs emit channel<%s>:%v", channelName, left)
484 c.Emit("sec", channelName, left)
485}
486
487func (c *MCSClient) recvChannelJoinConfirm(s []byte) {
488 glog.Debug("mcs recvChannelJoinConfirm", hex.EncodeToString(s))

Callers

nothing calls this directly

Calls 11

DebugFunction · 0.92
ReadUInt8Function · 0.92
ReadInteger16Function · 0.92
ReadEnumeratesFunction · 0.92
ReadLengthFunction · 0.92
ErrorFunction · 0.92
ReadBytesFunction · 0.92
DebugfFunction · 0.92
readMCSPDUHeaderFunction · 0.85
EmitMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected