This shows you the differences between two versions of the page.
appnote:interfaces [2018/04/17 15:33] multun created |
appnote:interfaces [2019/05/15 10:11] mcb30 |
||
---|---|---|---|
Line 2: | Line 2: | ||
iPXE-style interfaces were created to fulfil the need of transmitting | iPXE-style interfaces were created to fulfil the need of transmitting | ||
- | and transforming messages. For example, an http_connection interface would send data delivery messages to a tcp_socket interface, why can send some other data delivery messages in return later on. | + | and transforming messages. For example, an http_connection interface would send data delivery messages to a tcp_socket interface, which can send some other data delivery messages in return later on. |
==== Implementation ==== | ==== Implementation ==== | ||
Interfaces both act as a message handlers and carrier: | Interfaces both act as a message handlers and carrier: | ||
- | The http interface would pipe any message to the tcp interface, eventhough it | + | The http interface would pipe any message to the tcp interface, even though it |
may itself handle messages. It's done this way because a source object does not | may itself handle messages. It's done this way because a source object does not | ||
need to send messages to iself (it can just directly perform the job). | need to send messages to iself (it can just directly perform the job). | ||
- | Each interface can be seen as a unidirectional message pipe ((Messages aren't related to networking, but can rather be seen as function calls. Transmissing a message means dispatching the function call.)). | + | Each interface can be seen as a unidirectional message pipe ((Messages aren't related to networking, but can rather be seen as function calls. Transmitting a message means dispatching the function call.)). |
Two interfaces may be their mutual destination (the dhcp interface would send | Two interfaces may be their mutual destination (the dhcp interface would send | ||
messages to the udp socket, which would send messages back). | messages to the udp socket, which would send messages back). | ||
Line 21: | Line 21: | ||
Each interface contains a list of message handlers operating on the object ((Each interface contains an offset to the beginning of the object, which is used to retrieve its address when calling a method)). | Each interface contains a list of message handlers operating on the object ((Each interface contains an offset to the beginning of the object, which is used to retrieve its address when calling a method)). | ||
- | As an additionnal feature, when an interface does not implement a handler for | + | As an additional feature, when an interface does not implement a handler for |
some message type, it may know another interface from the same object (called | some message type, it may know another interface from the same object (called | ||
the passthrough interface), used as a carrier to another object's interface, | the passthrough interface), used as a carrier to another object's interface, | ||
Line 88: | Line 88: | ||
* In the previous example, the backend passes through unknown messages to xfer, and vice versa. Why doesn't it generate a loop ? | * In the previous example, the backend passes through unknown messages to xfer, and vice versa. Why doesn't it generate a loop ? | ||
- | Because messages are transfered to the destination of the passthrough interface. If it weren't the case, interfaces would be useless, as the original interface receiving the message would have the same ability to handle the message as the one it forwards the message to, as they both are from the same object. | + | Because messages are transferred to the destination of the passthrough interface. If it weren't the case, interfaces would be useless, as the original interface receiving the message would have the same ability to handle the message as the one it forwards the message to, as they both are from the same object. |
* How is memory managed ? I didn't see any reference counting. | * How is memory managed ? I didn't see any reference counting. |