static ber_slen_t sb_stream_write( Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len ) { assert( sbiod != NULL); assert( SOCKBUF_VALID( sbiod->sbiod_sb ) ); #if defined(MACOS) /* * MacTCP/OpenTransport */ #define MAX_WRITE 65535 return tcpwrite( sbiod->sbiod_sb->sb_fd, (unsigned char *)buf, (len<MAX_WRITE) ? len : MAX_WRITE ); #elif defined( HAVE_PCNFS) \ || defined( HAVE_WINSOCK) || defined ( __BEOS__ ) /* * PCNFS (under DOS) */ /* * Windows Socket API (under DOS/Windows 3.x) */ /* * 32-bit Windows Socket API (under Windows NT or Windows 95) */ { int rc = send( sbiod->sbiod_sb->sb_fd, buf, len, 0 ); #ifdef HAVE_WINSOCK if ( rc < 0 ) { int err; err = WSAGetLastError(); errno = err; } #endif return rc; } #elif defined(HAVE_NCSA) return netwrite( sbiod->sbiod_sb->sb_fd, buf, len ); #elif defined(VMS) /* * VMS -- each write must be 64K or smaller */ #define MAX_WRITE 65535 return write( sbiod->sbiod_sb->sb_fd, buf, (len<MAX_WRITE) ? len : MAX_WRITE); #else return write( sbiod->sbiod_sb->sb_fd, buf, len ); #endif }
static ber_slen_t sb_stream_write( Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len ) { assert( sbiod != NULL); assert( SOCKBUF_VALID( sbiod->sbiod_sb ) ); #if defined(MACOS) /* * MacTCP/OpenTransport */ #define MAX_WRITE 65535 return tcpwrite( sbiod->sbiod_sb->sb_fd, (unsigned char *)buf, (len<MAX_WRITE) ? len : MAX_WRITE ); #elif defined( HAVE_PCNFS) \ || defined( HAVE_WINSOCK) || defined ( __BEOS__ ) /* * PCNFS (under DOS) */ /* * Windows Socket API (under DOS/Windows 3.x) */ /* * 32-bit Windows Socket API (under Windows NT or Windows 95) */ return send( sbiod->sbiod_sb->sb_fd, (char*)buf, (int)len, 0 );// This should be safe, as ret will not exceed 2G. #elif defined(HAVE_NCSA) return netwrite( sbiod->sbiod_sb->sb_fd, buf, len ); #elif defined(VMS) /* * VMS -- each write must be 64K or smaller */ #define MAX_WRITE 65535 return write( sbiod->sbiod_sb->sb_fd, buf, (len<MAX_WRITE) ? len : MAX_WRITE); #else return write( sbiod->sbiod_sb->sb_fd, buf, len ); #endif }
static int master_register(int rfd,uint32_t cuid) { uint32_t i; const uint8_t *rptr; uint8_t *wptr,regbuff[8+73]; wptr = regbuff; put32bit(&wptr,CLTOMA_FUSE_REGISTER); put32bit(&wptr,73); memcpy(wptr,FUSE_REGISTER_BLOB_ACL,64); wptr+=64; put8bit(&wptr,REGISTER_TOOLS); put32bit(&wptr,cuid); put16bit(&wptr,VERSMAJ); put8bit(&wptr,VERSMID); put8bit(&wptr,VERSMIN); if (tcpwrite(rfd,regbuff,8+73)!=8+73) { printf("register to master: send error\n"); return -1; } if (tcpread(rfd,regbuff,9)!=9) { printf("register to master: receive error\n"); return -1; } rptr = regbuff; i = get32bit(&rptr); if (i!=MATOCL_FUSE_REGISTER) { printf("register to master: wrong answer (type)\n"); return -1; } i = get32bit(&rptr); if (i!=1) { printf("register to master: wrong answer (length)\n"); return -1; } if (*rptr) { printf("register to master: %s\n",mfsstrerr(*rptr)); return -1; } return 0; }