Class: SMB::CTX
- Inherits:
-
Object
- Object
- SMB::CTX
- Defined in:
- ext/smb/smb.c
Defined Under Namespace
Classes: SmbFile
Class Method Summary collapse
Instance Method Summary collapse
- #file_close(sfile) ⇒ Object
- #file_creat(*__p_argv, self) ⇒ Object
- #file_open(*__p_argv, self) ⇒ Object
- #file_write(sfile, data) ⇒ Object
- #initialize ⇒ Object constructor
Constructor Details
#initialize ⇒ Object
427 428 429 430 431 432 433 434 435 436 |
# File 'ext/smb/smb.c', line 427
static VALUE
CTX_initialize(VALUE self)
{
SMBCCTX *ctx; Data_Get_Struct(self, SMBCCTX, ctx);
#line 99 "/home/geoff/Projects/smb-ruby/ext/smb/smb.cr"
smbc_init_context(ctx);
return Qnil;
}
|
Class Method Details
.default ⇒ Object
396 397 398 399 400 401 402 403 404 405 |
# File 'ext/smb/smb.c', line 396
static VALUE
CTX_CLASS_default(VALUE self)
{
VALUE __p_retval = Qnil;
#line 90 "/home/geoff/Projects/smb-ruby/ext/smb/smb.cr"
do { __p_retval = Data_Wrap_Struct(self, NULL, smbc_free_context, smbc_set_context(NULL)); goto out; } while(0);
out:
return __p_retval;
}
|
Instance Method Details
#file_close(sfile) ⇒ Object
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 |
# File 'ext/smb/smb.c', line 541
static VALUE
CTX_file_close(VALUE self, VALUE sfile)
{
SMBCCTX *ctx; Data_Get_Struct(self, SMBCCTX, ctx);
Check_Type(sfile, T_DATA);
#line 122 "/home/geoff/Projects/smb-ruby/ext/smb/smb.cr"
do {
SMBCFILE * file ;
Data_Get_Struct(sfile, SMBCFILE, file);
ctx->close_fn(ctx, file);
} while(0);
return Qnil;
}
|
#file_creat(*__p_argv, self) ⇒ Object
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 |
# File 'ext/smb/smb.c', line 438
static VALUE
CTX_file_creat(int __p_argc, VALUE *__p_argv, VALUE self)
{
VALUE __p_retval = Qnil;
VALUE __v_url = Qnil;
char * url; char * __orig_url;
VALUE __v_mode = Qnil;
int mode; int __orig_mode;
SMBCCTX *ctx; Data_Get_Struct(self, SMBCCTX, ctx);
/* Scan arguments */
rb_scan_args(__p_argc, __p_argv, "11",&__v_url, &__v_mode);
/* Set defaults */
__orig_url = url = ( NIL_P(__v_url) ? NULL : StringValuePtr(__v_url) );
if (__p_argc > 1)
__orig_mode = mode = NUM2INT(__v_mode);
else
mode = 0666;
#line 105 "/home/geoff/Projects/smb-ruby/ext/smb/smb.cr"
do {
volatile VALUE rfile ;
SMBCFILE * file =
(smbc_getFunctionCreat(ctx))(ctx, url, mode);
rfile = Data_Wrap_Struct(cSmbFile, NULL, NULL, file);
do { __p_retval = rfile; goto out; } while(0);
} while(0);
out:
return __p_retval;
}
|
#file_open(*__p_argv, self) ⇒ Object
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 |
# File 'ext/smb/smb.c', line 475
static VALUE
CTX_file_open(int __p_argc, VALUE *__p_argv, VALUE self)
{
VALUE __p_retval = Qnil;
VALUE __v_url = Qnil;
char * url; char * __orig_url;
VALUE __v_flags = Qnil;
int flags; int __orig_flags;
VALUE __v_mode = Qnil;
int mode; int __orig_mode;
SMBCCTX *ctx; Data_Get_Struct(self, SMBCCTX, ctx);
/* Scan arguments */
rb_scan_args(__p_argc, __p_argv, "12",&__v_url, &__v_flags, &__v_mode);
/* Set defaults */
__orig_url = url = ( NIL_P(__v_url) ? NULL : StringValuePtr(__v_url) );
if (__p_argc > 1)
__orig_flags = flags = NUM2INT(__v_flags);
else
flags = O_RDONLY;
if (__p_argc > 2)
__orig_mode = mode = NUM2INT(__v_mode);
else
mode = 0666;
#line 111 "/home/geoff/Projects/smb-ruby/ext/smb/smb.cr"
do {
volatile VALUE rfile ;
SMBCFILE * file =
ctx->open(ctx, url, flags, mode);
rfile = Data_Wrap_Struct(cSmbFile, NULL, NULL, file);
do { __p_retval = rfile; goto out; } while(0);
} while(0);
out:
return __p_retval;
}
|
#file_write(sfile, data) ⇒ Object
519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 |
# File 'ext/smb/smb.c', line 519
static VALUE
CTX_file_write(VALUE self, VALUE sfile, VALUE data)
{
VALUE __p_retval = Qnil;
SMBCCTX *ctx; Data_Get_Struct(self, SMBCCTX, ctx);
Check_Type(sfile, T_DATA);
Check_Type(data, T_STRING);
#line 117 "/home/geoff/Projects/smb-ruby/ext/smb/smb.cr"
do {
SMBCFILE * file ;
Data_Get_Struct(sfile, SMBCFILE, file);
StringValue(data);
do { __p_retval = LONG2NUM(ctx->write(ctx, file, RSTRING_PTR(data), RSTRING_LEN(data))); goto out; } while(0);
} while(0);
out:
return __p_retval;
}
|