xaptum / hss Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v2.0
License: GNU General Public License v2.0
Provide descriptions and flowcharts for common operations. Including
The way HSS uses memcpy can cause issues when copying between different machines. This is necessary to address before upstreaming.
From the C99 standard
6.5.3.2 Address and indirection operators
87) Among the invalid values for dereferencing a pointer by the unary * operator are a null pointer, an address inappropriately aligned for the type of object pointed to, and the address of an object after the end of its lifetime.
In practice x86 does not care nor would our version of ARM, but other architectures like SPARC or older ARM chips will.
Take this struct (this a bug that I forgot to update when family went from 1 to 2 bytes).
struct hss_payload_connect_ip {
enum hss_family family; /* 2 bytes */
__u8 resvd; /* One byte */
/* Any sane compiler will place another 1 byte pad here */
__le16 port;
/* Padding here? */
union hss_payload_connect_ip_addr addr;
};
port
and addr
a 64-bit system may want to align to 8 byes and insert another 4-byte pad where a 32-bit system probably won't.The solution is to stop trying to entangle our defined format with the C structs. The members should match up in width and endianness, but memcpy needs to be used instead of typecasting and named assignments. I do not think this will have a performance hit, it's just tedious.
#35 only addressed packets sent by the host and received by the device. The two directions have diverged a fair amount from eachother over time. I would recommend making device->host communications look more like the recent updates.
None of this represents a bug because the deice will only transmit the subset of the spec the host can understand.
This was brought up during the OSS talk. The device has no ability to resolve domain names and the connect commands require an IP address, it would be useful to add functionality to relay DNS resolution data between the sides or allow a connection to a domain name instead of an IP address. In a followup conversation the person remarked "In most cases, we've seen so far, IP addresses are avoided because they are difficult to change later. Also even simple DNS round robin is useful for robustness and load balancing."
The person who asked did not express an interest in adapting HSS but this is still a good feature that should be addressed if we want wide usage.
Function scm_sock_create
currently passes the SCM error code back to the caller. To facilitate correct behavior this function should pass back the appropriate value from the POSIX call based on the SCM return code.
Create new command type for internal communication requests so the usb client can request information from the host. In this case we need the data from TCP sessions getsockname but there will almost certainly be others so a generic command with request data will be the best approach.
NCM provides some metadata about what Ethernet frames are inside a given USB transfer. We may have some utility for this in future applications so investigate why they do this and make room for a similar mechanism if it looks useful.
Use Hungarian notation for packet definitions.
Do not use Linux or other IDs to identify internet or transport protocol choices. Define them in the spec and have the implementer translate them to that type of connection.
Describe the USB endpoints in the documentation. This protocol is necessarily linked to sock types so describe those as well. Make sure to describe why we don't use control sockets for socket "control" methods (reordering, ect).
Current config has no dependencies, figure out which other modules are necessary as depends/selects and add them to the file.
Vendor ID is 0x02fe
and should be 0x2fe0
CLOSE and SHUTDOWN packets to not have room for error codes so a connection close looks identical to the device form an error code. The device needs to be told the reason for a socks close.
They are not currently used and we haven't given enough thought to their implementation to meaningfully spec it at this stage. So for the time being remove mentions from the documentation.
Current ACK protocols return Linux codes on error, this will not port well to Windows or other non-POSIX(ish) systems. Figure out the kind of codes we want to pass and manually define them. Provide a table to map POSIX and Windows codes to our protocol.
Device will have to manage synchronization to make sure we don't close before data is sent and similar problems. But we should move towards the more standard procedure of using a control endpoint to communicate these short (preferable low latency) commands. Rather than stacking every command into a bulk transfer, the bulk EP will become exclusively for handling write operations between the device and host.
Instead of using variable length payload packets for commands like CONNECT
, use fixed size command packets up to 64-bytes long. Dispense with the immediate
type and make all bulk transfers payload
.
Implementers may not want to store messages in memory waiting for a reply, have ACK return the opcode of the message so endpoints can maintain a state and know what is being responded to implicitly. (eg Device sends CONNECT
to host on sock 2
, if it receives a SUCCESS
ACK for that opcode it does not care what the actual sent message was since there cannot be two of them).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.