Explorar el Código

Eliminate PF_INET; just use the AF_INET from the struct sockaddr instead.

tags/v0.9.3
Michael Brown hace 17 años
padre
commit
1311b4194c
Se han modificado 1 ficheros con 20 adiciones y 12 borrados
  1. 20
    12
      src/net/tcp.c

+ 20
- 12
src/net/tcp.c Ver fichero

@@ -11,6 +11,7 @@
11 11
 #include <gpxe/refcnt.h>
12 12
 #include <gpxe/xfer.h>
13 13
 #include <gpxe/open.h>
14
+#include <gpxe/uri.h>
14 15
 #include <gpxe/tcpip.h>
15 16
 #include <gpxe/tcp.h>
16 17
 
@@ -962,15 +963,28 @@ static struct xfer_interface_operations tcp_xfer_operations = {
962 963
  ***************************************************************************
963 964
  */
964 965
 
965
-#warning "Placeholder URI opener"
966
+/** TCP socket opener */
967
+struct socket_opener tcp_socket_opener __socket_opener = {
968
+	.semantics	= SOCK_STREAM,
969
+	.family		= AF_INET,
970
+	.open		= tcp_open,
971
+};
972
+
973
+/**
974
+ * Open TCP URI
975
+ *
976
+ * @v xfer		Data transfer interface
977
+ * @v uri		URI
978
+ * @ret rc		Return status code
979
+ */
966 980
 static int tcp_open_uri ( struct xfer_interface *xfer, struct uri *uri ) {
967
-	struct sockaddr_in peer;
981
+	struct sockaddr_tcpip peer;
968 982
 
969 983
 	memset ( &peer, 0, sizeof ( peer ) );
970
-	peer.sin_family = AF_INET;
971
-	peer.sin_addr.s_addr = htonl ( 0x0afefe02 );
972
-	peer.sin_port = htons ( 12345 );
973
-	return tcp_open ( xfer, &peer, NULL );
984
+	peer.st_port = htons ( uri_port ( uri, 0 ) );
985
+	return xfer_open_named_socket ( xfer, SOCK_STREAM,
986
+					( struct sockaddr * ) &peer,
987
+					uri->host, NULL );
974 988
 }
975 989
 
976 990
 /** TCP URI opener */
@@ -979,9 +993,3 @@ struct uri_opener tcp_uri_opener __uri_opener = {
979 993
 	.open		= tcp_open_uri,
980 994
 };
981 995
 
982
-/** TCP socket opener */
983
-struct socket_opener tcp_socket_opener __socket_opener = {
984
-	.domain		= PF_INET,
985
-	.type		= SOCK_STREAM,
986
-	.open		= tcp_open,
987
-};

Loading…
Cancelar
Guardar