|
@@ -75,30 +75,29 @@ int xfer_open_uri ( struct xfer_interface *xfer, const char *uri_string ) {
|
75
|
75
|
* Open socket
|
76
|
76
|
*
|
77
|
77
|
* @v xfer Data transfer interface
|
78
|
|
- * @v domain Communication domain (e.g. PF_INET)
|
79
|
|
- * @v type Communication semantics (e.g. SOCK_STREAM)
|
|
78
|
+ * @v semantics Communication semantics (e.g. SOCK_STREAM)
|
80
|
79
|
* @v peer Peer socket address
|
81
|
80
|
* @v local Local socket address, or NULL
|
82
|
81
|
* @ret rc Return status code
|
83
|
82
|
*/
|
84
|
|
-int xfer_open_socket ( struct xfer_interface *xfer,
|
85
|
|
- int domain, int type, struct sockaddr *peer,
|
86
|
|
- struct sockaddr *local ) {
|
|
83
|
+int xfer_open_socket ( struct xfer_interface *xfer, int semantics,
|
|
84
|
+ struct sockaddr *peer, struct sockaddr *local ) {
|
87
|
85
|
struct socket_opener *opener;
|
88
|
86
|
|
89
|
87
|
DBGC ( xfer, "XFER %p opening (%s,%s) socket\n", xfer,
|
90
|
|
- socket_domain_name ( domain ), socket_type_name ( type ) );
|
|
88
|
+ socket_semantics_name ( semantics ),
|
|
89
|
+ socket_family_name ( peer->sa_family ) );
|
91
|
90
|
|
92
|
91
|
for ( opener = socket_openers; opener < socket_openers_end; opener++ ){
|
93
|
|
- if ( ( opener->domain == domain ) &&
|
94
|
|
- ( opener->type == type ) ) {
|
|
92
|
+ if ( ( opener->semantics == semantics ) &&
|
|
93
|
+ ( opener->family == peer->sa_family ) ) {
|
95
|
94
|
return opener->open ( xfer, peer, local );
|
96
|
95
|
}
|
97
|
96
|
}
|
98
|
97
|
|
99
|
98
|
DBGC ( xfer, "XFER %p attempted to open unsupported socket type "
|
100
|
|
- "(%s,%s)\n", xfer, socket_domain_name ( domain ),
|
101
|
|
- socket_type_name ( type ) );
|
|
99
|
+ "(%s,%s)\n", xfer, socket_semantics_name ( semantics ),
|
|
100
|
+ socket_family_name ( peer->sa_family ) );
|
102
|
101
|
return -ENOTSUP;
|
103
|
102
|
}
|
104
|
103
|
|
|
@@ -117,12 +116,11 @@ int xfer_vopen ( struct xfer_interface *xfer, int type, va_list args ) {
|
117
|
116
|
|
118
|
117
|
return xfer_open_uri ( xfer, uri_string ); }
|
119
|
118
|
case LOCATION_SOCKET: {
|
120
|
|
- int domain = va_arg ( args, int );
|
121
|
|
- int type = va_arg ( args, int );
|
|
119
|
+ int semantics = va_arg ( args, int );
|
122
|
120
|
struct sockaddr *peer = va_arg ( args, struct sockaddr * );
|
123
|
121
|
struct sockaddr *local = va_arg ( args, struct sockaddr * );
|
124
|
122
|
|
125
|
|
- return xfer_open_socket ( xfer, domain, type, peer, local ); }
|
|
123
|
+ return xfer_open_socket ( xfer, semantics, peer, local ); }
|
126
|
124
|
default:
|
127
|
125
|
DBGC ( xfer, "XFER %p attempted to open unsupported location "
|
128
|
126
|
"type %d\n", xfer, type );
|