Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add server side handling for [MS-RDPECAM] #8010

Merged
merged 11 commits into from
Jun 30, 2022

Conversation

pnowack
Copy link
Member

@pnowack pnowack commented Jun 29, 2022

This is a forward port of https://github.com/pnowack/FreeRDP/commits/rdpecam. Due to lack of time not all messages are tested. The ones, that are tested are tested with g-r-d with https://gitlab.gnome.org/pnowack/gnome-remote-desktop/-/commits/rdpecam.

Successfully tested messages:**

Enumerator messages:

SelectVersionRequest
SelectVersionResponse
DeviceAddedNotification

Device messages:

SuccessResponse
ErrorResponse
ActivateDeviceRequest
DeactivateDeviceRequest
StreamListRequest
StreamListResponse
MediaTypeListRequest
MediaTypeListResponse
CurrentMediaTypeRequest
CurrentMediaTypeResponse
StartStreamsRequest
StopStreamsRequest
SampleRequest
SampleResponse
PropertyListRequest
PropertyListResponse
PropertyValueRequest
PropertyValueResponse
SetPropertyValueRequest

Messages that weren't tested (yet), due to lack of time (they should work though):

Enumerator messages:

DeviceRemovedNotification (never received it)

Device messages:

SampleErrorResponse (never received it)

Would be good if you can take a more precise look at the untested messages.


Some messages only contain the shared message header. However, when sending such messages, the whole PDU can be provided or NULL.
The reason for this design is for forward compatibility. In case that in future versions one of these messages is extended with extra arguments, when using newer protocol versions, we don't need to add new APIs in form of ActivateDeviceRequest2 or similar.

For the device channel both the protocol version and virtual channel name need to be specified in the camera device server context by the API user.
The protocol version set in the context struct is used, when writing the shared message header, when sending any messages.

Server implementations should check for invalid virtual channel names, like already existing ones, or channels, that are known for different purposes (graphics pipeline, echo, etc.).

@freerdp-bot
Copy link

Can one of the admins verify this patch?

@akallabeth akallabeth added this to the next milestone Jun 29, 2022
Copy link
Contributor

@hardening hardening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM nothing show stopper

Copy link
Member

@akallabeth akallabeth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM,
some style issues and on missing event? (or did I miss that?)

include/freerdp/channels/camera-device.h Outdated Show resolved Hide resolved
include/freerdp/channels/camera-device.h Outdated Show resolved Hide resolved
include/freerdp/channels/camera-device.h Outdated Show resolved Hide resolved
include/freerdp/channels/camera-device.h Outdated Show resolved Hide resolved
channels/camera-device/server/camera_device_main.c Outdated Show resolved Hide resolved
channels/camera-device/server/camera_device_main.c Outdated Show resolved Hide resolved
channels/camera-device/server/camera_device_main.c Outdated Show resolved Hide resolved
channels/camera-device/server/camera_device_main.c Outdated Show resolved Hide resolved
channels/camera-device/server/camera_device_main.c Outdated Show resolved Hide resolved
@akallabeth
Copy link
Member

@pnowack oh, and all the pdu.header = *header; entries, there should be a WINPR_ASSERT(header); before that as the argument is required to be non NULL

@akallabeth
Copy link
Member

@pnowack another thing, maybe unify this whole thing in a single rdpecam channel subfolder (similar to urbdrc and video which also have a control and data channel internally)

@hardening
Copy link
Contributor

hardening commented Jun 29, 2022

Not specific to this PR, but the reading of data is done like in some other dynamic channels, and we have something rotten here. Dynamic channels are supposed to always receive fragmentation headers (so when you read, you receive fragheaders+data) and the frag header allows you to reassemble a complete PDU, but our FreeRDP VCM implementation doesn't respect that.

Unfortunately fixing that has the potential to break lots of external projects that have dynamic channel implementations (yes Ogon I'm pointing at you). I will open a discussion on this. We also have to talk about our WTSEventHandle specific flag that is so convenient that we use it in almost every channel but is broken in a nasty way under win32 (works most of the time, but not all the time).

@pnowack pnowack force-pushed the rdpecam-master branch 2 times, most recently from 8b3c60c to d9b36e3 Compare June 29, 2022 11:44
@pnowack
Copy link
Member Author

pnowack commented Jun 29, 2022

oh, and all the pdu.header = *header; entries, there should be a WINPR_ASSERT(header); before that as the argument is required to be non NULL

Done.

another thing, maybe unify this whole thing in a single rdpecam channel subfolder (similar to urbdrc and video which also have a control and data channel internally)

I hope I did that correctly in the last push

Not specific to this PR, but the reading of data is done like in some other dynamic channels, and we have something rotten here. Dynamic channels are supposed to always receive fragmentation headers (so when you read, you receive fragheaders+data) and the frag header allows you to reassemble a complete PDU, but our FreeRDP VCM implementation doesn't respect that.

I am not really sure, what to do here.

Unfortunately fixing that has the potential to break lots of external projects that have dynamic channel implementations (yes Ogon I'm pointing at you).

If fixing this would break external projects, then it would better be done for FreeRDP3 in my opinion.

@hardening
Copy link
Contributor

@pnowack yeah my general comment on dynamic channels was not meant for your PR, sorry for the noise.

@hardening
Copy link
Contributor

@freerdp-bot can you test that please buddy ?

@freerdp-bot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://ci.freerdp.com//job/PullRequestTester/7713/

@akallabeth
Copy link
Member

@freerdp-bot test

@freerdp-bot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://ci.freerdp.com//job/PullRequestTester/7716/

@akallabeth
Copy link
Member

@freerdp-bot test

@freerdp-bot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://ci.freerdp.com//job/PullRequestTester/7717/

@akallabeth
Copy link
Member

@freerdp-bot test

@freerdp-bot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://ci.freerdp.com//job/PullRequestTester/7719/

@akallabeth
Copy link
Member

@freerdp-bot test

@freerdp-bot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://ci.freerdp.com//job/PullRequestTester/7720/

@akallabeth
Copy link
Member

@freerdp-bot test

@akallabeth
Copy link
Member

@freerdp-bot be so kind, please test this again

@akallabeth
Copy link
Member

@freerdp-bot test

@freerdp-bot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://ci.freerdp.com//job/PullRequestTester/7722/

@freerdp-bot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://ci.freerdp.com//job/PullRequestTester/7723/

@akallabeth
Copy link
Member

@freerdp-bot test

@akallabeth
Copy link
Member

@freerdp-bot test

@freerdp-bot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://ci.freerdp.com//job/PullRequestTester/7724/

@freerdp-bot
Copy link

Refer to this link for build results (access rights to CI server needed):
https://ci.freerdp.com//job/PullRequestTester/7725/

@akallabeth akallabeth merged commit 90bb236 into FreeRDP:master Jun 30, 2022
@pnowack pnowack deleted the rdpecam-master branch July 15, 2022 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants