• Home
  • Raw
  • Download

Lines Matching refs:ctxt

302     xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;  in xmlNanoFTPScanURL()  local
308 if (ctxt->protocol != NULL) { in xmlNanoFTPScanURL()
309 xmlFree(ctxt->protocol); in xmlNanoFTPScanURL()
310 ctxt->protocol = NULL; in xmlNanoFTPScanURL()
312 if (ctxt->hostname != NULL) { in xmlNanoFTPScanURL()
313 xmlFree(ctxt->hostname); in xmlNanoFTPScanURL()
314 ctxt->hostname = NULL; in xmlNanoFTPScanURL()
316 if (ctxt->path != NULL) { in xmlNanoFTPScanURL()
317 xmlFree(ctxt->path); in xmlNanoFTPScanURL()
318 ctxt->path = NULL; in xmlNanoFTPScanURL()
331 ctxt->protocol = xmlMemStrdup(uri->scheme); in xmlNanoFTPScanURL()
332 ctxt->hostname = xmlMemStrdup(uri->server); in xmlNanoFTPScanURL()
334 ctxt->path = xmlMemStrdup(uri->path); in xmlNanoFTPScanURL()
336 ctxt->path = xmlMemStrdup("/"); in xmlNanoFTPScanURL()
338 ctxt->port = uri->port; in xmlNanoFTPScanURL()
343 ctxt->user = xmlMemStrdup(uri->user); in xmlNanoFTPScanURL()
345 ctxt->user = (char *)xmlStrndup((xmlChar *)uri->user, in xmlNanoFTPScanURL()
347 ctxt->passwd = xmlMemStrdup(cptr+1); in xmlNanoFTPScanURL()
371 xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; in xmlNanoFTPUpdateURL() local
376 if (ctxt == NULL) in xmlNanoFTPUpdateURL()
378 if (ctxt->protocol == NULL) in xmlNanoFTPUpdateURL()
380 if (ctxt->hostname == NULL) in xmlNanoFTPUpdateURL()
391 if ((strcmp(ctxt->protocol, uri->scheme)) || in xmlNanoFTPUpdateURL()
392 (strcmp(ctxt->hostname, uri->server)) || in xmlNanoFTPUpdateURL()
393 ((uri->port != 0) && (ctxt->port != uri->port))) { in xmlNanoFTPUpdateURL()
399 ctxt->port = uri->port; in xmlNanoFTPUpdateURL()
401 if (ctxt->path != NULL) { in xmlNanoFTPUpdateURL()
402 xmlFree(ctxt->path); in xmlNanoFTPUpdateURL()
403 ctxt->path = NULL; in xmlNanoFTPUpdateURL()
407 ctxt->path = xmlMemStrdup("/"); in xmlNanoFTPUpdateURL()
409 ctxt->path = xmlMemStrdup(uri->path); in xmlNanoFTPUpdateURL()
509 xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; in xmlNanoFTPFreeCtxt() local
510 if (ctxt == NULL) return; in xmlNanoFTPFreeCtxt()
511 if (ctxt->hostname != NULL) xmlFree(ctxt->hostname); in xmlNanoFTPFreeCtxt()
512 if (ctxt->protocol != NULL) xmlFree(ctxt->protocol); in xmlNanoFTPFreeCtxt()
513 if (ctxt->path != NULL) xmlFree(ctxt->path); in xmlNanoFTPFreeCtxt()
514 ctxt->passive = 1; in xmlNanoFTPFreeCtxt()
515 if (ctxt->controlFd != INVALID_SOCKET) closesocket(ctxt->controlFd); in xmlNanoFTPFreeCtxt()
516 ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPFreeCtxt()
517 ctxt->controlBufIndex = -1; in xmlNanoFTPFreeCtxt()
518 ctxt->controlBufUsed = -1; in xmlNanoFTPFreeCtxt()
519 xmlFree(ctxt); in xmlNanoFTPFreeCtxt()
567 xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; in xmlNanoFTPGetMore() local
571 if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1); in xmlNanoFTPGetMore()
573 if ((ctxt->controlBufIndex < 0) || (ctxt->controlBufIndex > FTP_BUF_SIZE)) { in xmlNanoFTPGetMore()
577 ctxt->controlBufIndex); in xmlNanoFTPGetMore()
582 if ((ctxt->controlBufUsed < 0) || (ctxt->controlBufUsed > FTP_BUF_SIZE)) { in xmlNanoFTPGetMore()
586 ctxt->controlBufUsed); in xmlNanoFTPGetMore()
590 if (ctxt->controlBufIndex > ctxt->controlBufUsed) { in xmlNanoFTPGetMore()
594 ctxt->controlBufIndex, ctxt->controlBufUsed); in xmlNanoFTPGetMore()
602 if (ctxt->controlBufIndex > 0) { in xmlNanoFTPGetMore()
603 memmove(&ctxt->controlBuf[0], &ctxt->controlBuf[ctxt->controlBufIndex], in xmlNanoFTPGetMore()
604 ctxt->controlBufUsed - ctxt->controlBufIndex); in xmlNanoFTPGetMore()
605 ctxt->controlBufUsed -= ctxt->controlBufIndex; in xmlNanoFTPGetMore()
606 ctxt->controlBufIndex = 0; in xmlNanoFTPGetMore()
608 size = FTP_BUF_SIZE - ctxt->controlBufUsed; in xmlNanoFTPGetMore()
612 "xmlNanoFTPGetMore : buffer full %d \n", ctxt->controlBufUsed); in xmlNanoFTPGetMore()
620 if ((len = recv(ctxt->controlFd, &ctxt->controlBuf[ctxt->controlBufIndex], in xmlNanoFTPGetMore()
623 closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPGetMore()
624 ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPGetMore()
630 ctxt->controlBufUsed, ctxt->controlBufUsed + len); in xmlNanoFTPGetMore()
632 ctxt->controlBufUsed += len; in xmlNanoFTPGetMore()
633 ctxt->controlBuf[ctxt->controlBufUsed] = 0; in xmlNanoFTPGetMore()
647 xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; in xmlNanoFTPReadResponse() local
652 if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1); in xmlNanoFTPReadResponse()
663 if ((ctxt->controlBufUsed == 0) && (len == 0)) { in xmlNanoFTPReadResponse()
666 ptr = &ctxt->controlBuf[ctxt->controlBufIndex]; in xmlNanoFTPReadResponse()
667 end = &ctxt->controlBuf[ctxt->controlBufUsed]; in xmlNanoFTPReadResponse()
683 ctxt->controlBufAnswer = ptr - ctxt->controlBuf; in xmlNanoFTPReadResponse()
691 ctxt->controlBufIndex = ctxt->controlBufUsed; in xmlNanoFTPReadResponse()
698 ctxt->controlBufIndex = ptr - ctxt->controlBuf; in xmlNanoFTPReadResponse()
700 ptr = &ctxt->controlBuf[ctxt->controlBufIndex]; in xmlNanoFTPReadResponse()
737 xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; in xmlNanoFTPCheckResponse() local
741 if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1); in xmlNanoFTPCheckResponse()
745 FD_SET(ctxt->controlFd, &rfd); in xmlNanoFTPCheckResponse()
746 switch(select(ctxt->controlFd + 1, &rfd, NULL, NULL, &tv)) { in xmlNanoFTPCheckResponse()
764 xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; in xmlNanoFTPSendUser() local
769 if (ctxt->user == NULL) in xmlNanoFTPSendUser()
772 snprintf(buf, sizeof(buf), "USER %s\r\n", ctxt->user); in xmlNanoFTPSendUser()
778 res = send(ctxt->controlFd, buf, len, 0); in xmlNanoFTPSendUser()
792 xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; in xmlNanoFTPSendPasswd() local
797 if (ctxt->passwd == NULL) in xmlNanoFTPSendPasswd()
800 snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd); in xmlNanoFTPSendPasswd()
806 res = send(ctxt->controlFd, buf, len, 0); in xmlNanoFTPSendPasswd()
826 xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; in xmlNanoFTPQuit() local
830 if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1); in xmlNanoFTPQuit()
837 res = send(ctxt->controlFd, buf, len, 0); in xmlNanoFTPQuit()
856 xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; in xmlNanoFTPConnect() local
862 if (ctxt == NULL) in xmlNanoFTPConnect()
864 if (ctxt->hostname == NULL) in xmlNanoFTPConnect()
873 port = ctxt->port; in xmlNanoFTPConnect()
878 memset (&ctxt->ftpAddr, 0, sizeof(ctxt->ftpAddr)); in xmlNanoFTPConnect()
895 if (getaddrinfo (ctxt->hostname, NULL, &hints, &result) != 0) { in xmlNanoFTPConnect()
910 if (tmp->ai_addrlen > sizeof(ctxt->ftpAddr)) { in xmlNanoFTPConnect()
915 memcpy (&ctxt->ftpAddr, tmp->ai_addr, tmp->ai_addrlen); in xmlNanoFTPConnect()
916 ((struct sockaddr_in6 *) &ctxt->ftpAddr)->sin6_port = htons (port); in xmlNanoFTPConnect()
917 ctxt->controlFd = socket (AF_INET6, SOCK_STREAM, 0); in xmlNanoFTPConnect()
920 memcpy (&ctxt->ftpAddr, tmp->ai_addr, tmp->ai_addrlen); in xmlNanoFTPConnect()
921 ((struct sockaddr_in *) &ctxt->ftpAddr)->sin_port = htons (port); in xmlNanoFTPConnect()
922 ctxt->controlFd = socket (AF_INET, SOCK_STREAM, 0); in xmlNanoFTPConnect()
933 hp = gethostbyname (ctxt->hostname); in xmlNanoFTPConnect()
939 sizeof(((struct sockaddr_in *)&ctxt->ftpAddr)->sin_addr)) { in xmlNanoFTPConnect()
947 ((struct sockaddr_in *)&ctxt->ftpAddr)->sin_family = AF_INET; in xmlNanoFTPConnect()
948 memcpy (&((struct sockaddr_in *)&ctxt->ftpAddr)->sin_addr, in xmlNanoFTPConnect()
950 ((struct sockaddr_in *)&ctxt->ftpAddr)->sin_port = (u_short)htons ((unsigned short)port); in xmlNanoFTPConnect()
951 ctxt->controlFd = socket (AF_INET, SOCK_STREAM, 0); in xmlNanoFTPConnect()
955 if (ctxt->controlFd == INVALID_SOCKET) { in xmlNanoFTPConnect()
963 if (connect(ctxt->controlFd, (struct sockaddr *) &ctxt->ftpAddr, in xmlNanoFTPConnect()
966 closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
967 ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
974 res = xmlNanoFTPGetResponse(ctxt); in xmlNanoFTPConnect()
976 closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
977 ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1030 res = send(ctxt->controlFd, buf, len, 0); in xmlNanoFTPConnect()
1033 closesocket(ctxt->controlFd); in xmlNanoFTPConnect()
1034 ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1037 res = xmlNanoFTPGetResponse(ctxt); in xmlNanoFTPConnect()
1052 res = send(ctxt->controlFd, buf, len, 0); in xmlNanoFTPConnect()
1055 closesocket(ctxt->controlFd); in xmlNanoFTPConnect()
1056 ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1059 res = xmlNanoFTPGetResponse(ctxt); in xmlNanoFTPConnect()
1061 closesocket(ctxt->controlFd); in xmlNanoFTPConnect()
1062 ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1072 closesocket(ctxt->controlFd); in xmlNanoFTPConnect()
1073 ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1087 snprintf(buf, sizeof(buf), "SITE %s\r\n", ctxt->hostname); in xmlNanoFTPConnect()
1093 res = send(ctxt->controlFd, buf, len, 0); in xmlNanoFTPConnect()
1096 closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1097 ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1100 res = xmlNanoFTPGetResponse(ctxt); in xmlNanoFTPConnect()
1107 closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1108 ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1113 if (ctxt->user == NULL) in xmlNanoFTPConnect()
1115 ctxt->hostname); in xmlNanoFTPConnect()
1118 ctxt->user, ctxt->hostname); in xmlNanoFTPConnect()
1124 res = send(ctxt->controlFd, buf, len, 0); in xmlNanoFTPConnect()
1127 closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1128 ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1131 res = xmlNanoFTPGetResponse(ctxt); in xmlNanoFTPConnect()
1137 if (ctxt->passwd == NULL) in xmlNanoFTPConnect()
1140 snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd); in xmlNanoFTPConnect()
1146 res = send(ctxt->controlFd, buf, len, 0); in xmlNanoFTPConnect()
1149 closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1150 ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1153 res = xmlNanoFTPGetResponse(ctxt); in xmlNanoFTPConnect()
1160 closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1161 ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1170 closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1171 ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1178 res = xmlNanoFTPSendUser(ctxt); in xmlNanoFTPConnect()
1180 closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1181 ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1184 res = xmlNanoFTPGetResponse(ctxt); in xmlNanoFTPConnect()
1195 closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1196 ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1199 res = xmlNanoFTPSendPasswd(ctxt); in xmlNanoFTPConnect()
1201 closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1202 ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1205 res = xmlNanoFTPGetResponse(ctxt); in xmlNanoFTPConnect()
1217 closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1218 ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPConnect()
1237 xmlNanoFTPCtxtPtr ctxt; in xmlNanoFTPConnectTo() local
1245 ctxt = (xmlNanoFTPCtxtPtr) xmlNanoFTPNewCtxt(NULL); in xmlNanoFTPConnectTo()
1246 ctxt->hostname = xmlMemStrdup(server); in xmlNanoFTPConnectTo()
1248 ctxt->port = port; in xmlNanoFTPConnectTo()
1249 res = xmlNanoFTPConnect(ctxt); in xmlNanoFTPConnectTo()
1251 xmlNanoFTPFreeCtxt(ctxt); in xmlNanoFTPConnectTo()
1254 return(ctxt); in xmlNanoFTPConnectTo()
1269 xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; in xmlNanoFTPCwd() local
1274 if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1); in xmlNanoFTPCwd()
1290 res = send(ctxt->controlFd, buf, len, 0); in xmlNanoFTPCwd()
1295 res = xmlNanoFTPGetResponse(ctxt); in xmlNanoFTPCwd()
1318 xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; in xmlNanoFTPDele() local
1323 if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET) || (file == NULL)) return(-1); in xmlNanoFTPDele()
1341 res = send(ctxt->controlFd, buf, len, 0); in xmlNanoFTPDele()
1346 res = xmlNanoFTPGetResponse(ctxt); in xmlNanoFTPDele()
1368 xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; in xmlNanoFTPGetConnection() local
1381 if (ctxt == NULL) return INVALID_SOCKET; in xmlNanoFTPGetConnection()
1385 if ((ctxt->ftpAddr).ss_family == AF_INET6) { in xmlNanoFTPGetConnection()
1386 ctxt->dataFd = socket (AF_INET6, SOCK_STREAM, IPPROTO_TCP); in xmlNanoFTPGetConnection()
1392 ctxt->dataFd = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); in xmlNanoFTPGetConnection()
1397 if (ctxt->dataFd == INVALID_SOCKET) { in xmlNanoFTPGetConnection()
1402 if (ctxt->passive) { in xmlNanoFTPGetConnection()
1404 if ((ctxt->ftpAddr).ss_family == AF_INET6) in xmlNanoFTPGetConnection()
1413 res = send(ctxt->controlFd, buf, len, 0); in xmlNanoFTPGetConnection()
1416 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPGetConnection()
1422 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPGetConnection()
1428 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPGetConnection()
1429 ctxt->passive = 0; in xmlNanoFTPGetConnection()
1432 cur = &ctxt->controlBuf[ctxt->controlBufAnswer]; in xmlNanoFTPGetConnection()
1435 if ((ctxt->ftpAddr).ss_family == AF_INET6) { in xmlNanoFTPGetConnection()
1439 if (ctxt->dataFd != INVALID_SOCKET) { in xmlNanoFTPGetConnection()
1440 closesocket (ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPGetConnection()
1444 …memcpy (&((struct sockaddr_in6 *)&dataAddr)->sin6_addr, &((struct sockaddr_in6 *)&ctxt->ftpAddr)->… in xmlNanoFTPGetConnection()
1454 if (ctxt->dataFd != INVALID_SOCKET) { in xmlNanoFTPGetConnection()
1455 closesocket (ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPGetConnection()
1464 if (connect(ctxt->dataFd, (struct sockaddr *) &dataAddr, dataAddrLen) < 0) { in xmlNanoFTPGetConnection()
1466 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPGetConnection()
1470 getsockname(ctxt->dataFd, (struct sockaddr *) &dataAddr, &dataAddrLen); in xmlNanoFTPGetConnection()
1472 if ((ctxt->ftpAddr).ss_family == AF_INET6) in xmlNanoFTPGetConnection()
1478 if (bind(ctxt->dataFd, (struct sockaddr *) &dataAddr, dataAddrLen) < 0) { in xmlNanoFTPGetConnection()
1480 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPGetConnection()
1483 getsockname(ctxt->dataFd, (struct sockaddr *) &dataAddr, &dataAddrLen); in xmlNanoFTPGetConnection()
1485 if (listen(ctxt->dataFd, 1) < 0) { in xmlNanoFTPGetConnection()
1487 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPGetConnection()
1491 if ((ctxt->ftpAddr).ss_family == AF_INET6) { in xmlNanoFTPGetConnection()
1514 res = send(ctxt->controlFd, buf, len, 0); in xmlNanoFTPGetConnection()
1517 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPGetConnection()
1520 res = xmlNanoFTPGetResponse(ctxt); in xmlNanoFTPGetConnection()
1522 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPGetConnection()
1526 return(ctxt->dataFd); in xmlNanoFTPGetConnection()
1541 xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; in xmlNanoFTPCloseConnection() local
1546 if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1); in xmlNanoFTPCloseConnection()
1548 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPCloseConnection()
1552 FD_SET(ctxt->controlFd, &rfd); in xmlNanoFTPCloseConnection()
1554 FD_SET(ctxt->controlFd, &efd); in xmlNanoFTPCloseConnection()
1555 res = select(ctxt->controlFd + 1, &rfd, NULL, &efd, &tv); in xmlNanoFTPCloseConnection()
1560 closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPCloseConnection()
1568 closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPCloseConnection()
1570 res = xmlNanoFTPGetResponse(ctxt); in xmlNanoFTPCloseConnection()
1572 closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPCloseConnection()
1721 xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; in xmlNanoFTPList() local
1728 if (ctxt == NULL) return (-1); in xmlNanoFTPList()
1730 if (xmlNanoFTPCwd(ctxt, ctxt->path) < 1) in xmlNanoFTPList()
1732 ctxt->dataFd = xmlNanoFTPGetConnection(ctxt); in xmlNanoFTPList()
1733 if (ctxt->dataFd == INVALID_SOCKET) in xmlNanoFTPList()
1738 if (xmlNanoFTPCwd(ctxt, ctxt->path) < 1) in xmlNanoFTPList()
1741 ctxt->dataFd = xmlNanoFTPGetConnection(ctxt); in xmlNanoFTPList()
1742 if (ctxt->dataFd == INVALID_SOCKET) in xmlNanoFTPList()
1751 res = send(ctxt->controlFd, buf, len, 0); in xmlNanoFTPList()
1754 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPList()
1757 res = xmlNanoFTPReadResponse(ctxt); in xmlNanoFTPList()
1759 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPList()
1767 FD_SET(ctxt->dataFd, &rfd); in xmlNanoFTPList()
1769 FD_SET(ctxt->dataFd, &efd); in xmlNanoFTPList()
1770 res = select(ctxt->dataFd + 1, &rfd, NULL, &efd, &tv); in xmlNanoFTPList()
1775 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPList()
1779 res = xmlNanoFTPCheckResponse(ctxt); in xmlNanoFTPList()
1781 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPList()
1782 ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPList()
1786 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPList()
1793 if ((len = recv(ctxt->dataFd, &buf[indx], sizeof(buf) - (indx + 1), 0)) < 0) { in xmlNanoFTPList()
1795 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPList()
1796 ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPList()
1813 xmlNanoFTPCloseConnection(ctxt); in xmlNanoFTPList()
1830 xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; in xmlNanoFTPGetSocket() local
1835 if ((filename == NULL) && (ctxt->path == NULL)) in xmlNanoFTPGetSocket()
1837 ctxt->dataFd = xmlNanoFTPGetConnection(ctxt); in xmlNanoFTPGetSocket()
1838 if (ctxt->dataFd == INVALID_SOCKET) in xmlNanoFTPGetSocket()
1846 res = send(ctxt->controlFd, buf, len, 0); in xmlNanoFTPGetSocket()
1849 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPGetSocket()
1852 res = xmlNanoFTPReadResponse(ctxt); in xmlNanoFTPGetSocket()
1854 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPGetSocket()
1858 snprintf(buf, sizeof(buf), "RETR %s\r\n", ctxt->path); in xmlNanoFTPGetSocket()
1866 res = send(ctxt->controlFd, buf, len, 0); in xmlNanoFTPGetSocket()
1869 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPGetSocket()
1872 res = xmlNanoFTPReadResponse(ctxt); in xmlNanoFTPGetSocket()
1874 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPGetSocket()
1877 return(ctxt->dataFd); in xmlNanoFTPGetSocket()
1896 xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; in xmlNanoFTPGet() local
1902 if (ctxt == NULL) return(-1); in xmlNanoFTPGet()
1903 if ((filename == NULL) && (ctxt->path == NULL)) in xmlNanoFTPGet()
1907 if (xmlNanoFTPGetSocket(ctxt, filename) == INVALID_SOCKET) in xmlNanoFTPGet()
1914 FD_SET(ctxt->dataFd, &rfd); in xmlNanoFTPGet()
1915 res = select(ctxt->dataFd + 1, &rfd, NULL, NULL, &tv); in xmlNanoFTPGet()
1920 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPGet()
1924 res = xmlNanoFTPCheckResponse(ctxt); in xmlNanoFTPGet()
1926 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPGet()
1927 ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPGet()
1931 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPGet()
1937 if ((len = recv(ctxt->dataFd, buf, sizeof(buf), 0)) < 0) { in xmlNanoFTPGet()
1940 closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPGet()
1946 return(xmlNanoFTPCloseConnection(ctxt)); in xmlNanoFTPGet()
1963 xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; in xmlNanoFTPRead() local
1966 if (ctxt->dataFd == INVALID_SOCKET) return(0); in xmlNanoFTPRead()
1970 len = recv(ctxt->dataFd, dest, len, 0); in xmlNanoFTPRead()
1974 xmlNanoFTPCloseConnection(ctxt); in xmlNanoFTPRead()
1993 xmlNanoFTPCtxtPtr ctxt; in xmlNanoFTPOpen() local
2000 ctxt = (xmlNanoFTPCtxtPtr) xmlNanoFTPNewCtxt(URL); in xmlNanoFTPOpen()
2001 if (ctxt == NULL) return(NULL); in xmlNanoFTPOpen()
2002 if (xmlNanoFTPConnect(ctxt) < 0) { in xmlNanoFTPOpen()
2003 xmlNanoFTPFreeCtxt(ctxt); in xmlNanoFTPOpen()
2006 sock = xmlNanoFTPGetSocket(ctxt, ctxt->path); in xmlNanoFTPOpen()
2008 xmlNanoFTPFreeCtxt(ctxt); in xmlNanoFTPOpen()
2011 return(ctxt); in xmlNanoFTPOpen()
2025 xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; in xmlNanoFTPClose() local
2027 if (ctxt == NULL) in xmlNanoFTPClose()
2030 if (ctxt->dataFd != INVALID_SOCKET) { in xmlNanoFTPClose()
2031 closesocket(ctxt->dataFd); in xmlNanoFTPClose()
2032 ctxt->dataFd = INVALID_SOCKET; in xmlNanoFTPClose()
2034 if (ctxt->controlFd != INVALID_SOCKET) { in xmlNanoFTPClose()
2035 xmlNanoFTPQuit(ctxt); in xmlNanoFTPClose()
2036 closesocket(ctxt->controlFd); in xmlNanoFTPClose()
2037 ctxt->controlFd = INVALID_SOCKET; in xmlNanoFTPClose()
2039 xmlNanoFTPFreeCtxt(ctxt); in xmlNanoFTPClose()
2067 void *ctxt; in main() local
2073 ctxt = xmlNanoFTPNewCtxt(argv[1]); in main()
2074 if (xmlNanoFTPConnect(ctxt) < 0) { in main()
2082 ctxt = xmlNanoFTPConnectTo("localhost", 0); in main()
2083 if (ctxt == NULL) { in main()
2088 xmlNanoFTPList(ctxt, ftpList, NULL, tstfile); in main()
2091 if (xmlNanoFTPGet(ctxt, ftpData, (void *) output, tstfile) < 0) in main()
2096 xmlNanoFTPClose(ctxt); in main()