1 | /* $Id: UsbTestServiceProtocol.cpp 93115 2022-01-01 11:31:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * UsbTestService - Remote USB test configuration and execution server, Protocol helpers.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2016-2022 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 |
|
---|
28 | /*********************************************************************************************************************************
|
---|
29 | * Header Files *
|
---|
30 | *********************************************************************************************************************************/
|
---|
31 | #define LOG_GROUP RTLOGGROUP_DEFAULT
|
---|
32 | #include <iprt/asm.h>
|
---|
33 | #include <iprt/cdefs.h>
|
---|
34 |
|
---|
35 | #include "UsbTestServiceProtocol.h"
|
---|
36 |
|
---|
37 |
|
---|
38 |
|
---|
39 | /**
|
---|
40 | * Converts a UTS packet header from host to network byte order.
|
---|
41 | *
|
---|
42 | * @returns nothing.
|
---|
43 | * @param pPktHdr The packet header to convert.
|
---|
44 | */
|
---|
45 | DECLINLINE(void) utsProtocolPktHdrH2N(PUTSPKTHDR pPktHdr)
|
---|
46 | {
|
---|
47 | pPktHdr->cb = RT_H2N_U32(pPktHdr->cb);
|
---|
48 | pPktHdr->uCrc32 = RT_H2N_U32(pPktHdr->uCrc32);
|
---|
49 | }
|
---|
50 |
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * Converts a UTS packet header from network to host byte order.
|
---|
54 | *
|
---|
55 | * @returns nothing.
|
---|
56 | * @param pPktHdr The packet header to convert.
|
---|
57 | */
|
---|
58 | DECLINLINE(void) utsProtocolPktHdrN2H(PUTSPKTHDR pPktHdr)
|
---|
59 | {
|
---|
60 | pPktHdr->cb = RT_N2H_U32(pPktHdr->cb);
|
---|
61 | pPktHdr->uCrc32 = RT_N2H_U32(pPktHdr->uCrc32);
|
---|
62 | }
|
---|
63 |
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * Converts a UTS status header from host to network byte order.
|
---|
67 | *
|
---|
68 | * @returns nothing.
|
---|
69 | * @param pPktHdr The packet header to convert.
|
---|
70 | */
|
---|
71 | DECLINLINE(void) utsProtocolStsHdrH2N(PUTSPKTSTS pPktHdr)
|
---|
72 | {
|
---|
73 | utsProtocolPktHdrH2N(&pPktHdr->Hdr);
|
---|
74 | pPktHdr->rcReq = RT_H2N_U32(pPktHdr->rcReq);
|
---|
75 | pPktHdr->cchStsMsg = RT_H2N_U32(pPktHdr->cchStsMsg);
|
---|
76 | }
|
---|
77 |
|
---|
78 |
|
---|
79 | /**
|
---|
80 | * Converts a UTS status header from network to host byte order.
|
---|
81 | *
|
---|
82 | * @returns nothing.
|
---|
83 | * @param pPktHdr The packet header to convert.
|
---|
84 | */
|
---|
85 | DECLINLINE(void) utsProtocolStsHdrN2H(PUTSPKTSTS pPktHdr)
|
---|
86 | {
|
---|
87 | utsProtocolPktHdrN2H(&pPktHdr->Hdr);
|
---|
88 | pPktHdr->rcReq = RT_N2H_U32(pPktHdr->rcReq);
|
---|
89 | pPktHdr->cchStsMsg = RT_N2H_U32(pPktHdr->cchStsMsg);
|
---|
90 | }
|
---|
91 |
|
---|
92 |
|
---|
93 | DECLHIDDEN(void) utsProtocolReqH2N(PUTSPKTHDR pPktHdr)
|
---|
94 | {
|
---|
95 | utsProtocolPktHdrH2N(pPktHdr);
|
---|
96 | }
|
---|
97 |
|
---|
98 |
|
---|
99 | DECLHIDDEN(void) utsProtocolReqN2H(PUTSPKTHDR pPktHdr)
|
---|
100 | {
|
---|
101 | RT_NOREF1(pPktHdr);
|
---|
102 | }
|
---|
103 |
|
---|
104 |
|
---|
105 | DECLHIDDEN(void) utsProtocolRepH2N(PUTSPKTSTS pPktHdr)
|
---|
106 | {
|
---|
107 | RT_NOREF1(pPktHdr);
|
---|
108 | }
|
---|
109 |
|
---|
110 |
|
---|
111 | DECLHIDDEN(void) utsProtocolRepN2H(PUTSPKTSTS pPktHdr)
|
---|
112 | {
|
---|
113 | RT_NOREF1(pPktHdr);
|
---|
114 | }
|
---|