本文整理汇总了C++中s_mark_end函数的典型用法代码示例。如果您正苦于以下问题:C++ s_mark_end函数的具体用法?C++ s_mark_end怎么用?C++ s_mark_end使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了s_mark_end函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rdp_send_client_window_status
/* Send a client window information PDU */
void
rdp_send_client_window_status(int status)
{
STREAM s;
static int current_status = 1;
if (current_status == status)
return;
s = rdp_init_data(12);
out_uint32_le(s, status);
switch (status)
{
case 0: /* shut the server up */
break;
case 1: /* receive data again */
out_uint32_le(s, 0); /* unknown */
out_uint16_le(s, g_width);
out_uint16_le(s, g_height);
break;
}
s_mark_end(s);
rdp_send_data(s, RDP_DATA_PDU_CLIENT_WINDOW_STATUS);
current_status = status;
}
示例2: libxrdp_send_bell
int EXPORT_CC
libxrdp_send_bell(struct xrdp_session *session)
{
struct stream *s = (struct stream *)NULL;
DEBUG(("libxrdp_send_bell sending bell signal"));
/* see MS documentation: Server play sound PDU, TS_PLAY_SOUND_PDU_DATA */
make_stream(s);
init_stream(s, 8192);
if (xrdp_rdp_init_data((struct xrdp_rdp *)session->rdp, s) != 0)
{
free_stream(s);
return 1;
}
out_uint32_le(s, 440); /* frequency */
out_uint32_le(s, 100); /* duration (ms) */
s_mark_end(s);
if (xrdp_rdp_send_data((struct xrdp_rdp *)session->rdp, s, RDP_DATA_PDU_PLAY_SOUND) != 0)
{
free_stream(s);
return 1;
}
free_stream(s);
return 0;
}
示例3: rdp_iso_send_msg
static int APP_CC
rdp_iso_send_msg(struct rdp_iso *self, struct stream *s, int code)
{
if (rdp_tcp_init(self->tcp_layer, s) != 0)
{
return 1;
}
out_uint8(s, 3);
out_uint8(s, 0);
out_uint16_be(s, 11); /* length */
out_uint8(s, 6);
out_uint8(s, code);
out_uint16_le(s, 0);
out_uint16_le(s, 0);
out_uint8(s, 0);
s_mark_end(s);
if (rdp_tcp_send(self->tcp_layer, s) != 0)
{
return 1;
}
return 0;
}
示例4: iso_send_connection_request
static void
iso_send_connection_request(char *username)
{
STREAM s;
int length = 30 + strlen(username);
s = tcp_init(length);
out_uint8(s, 3); /* version */
out_uint8(s, 0); /* reserved */
out_uint16_be(s, length); /* length */
out_uint8(s, length - 5); /* hdrlen */
out_uint8(s, ISO_PDU_CR);
out_uint16(s, 0); /* dst_ref */
out_uint16(s, 0); /* src_ref */
out_uint8(s, 0); /* class */
out_uint8p(s, "Cookie: mstshash=", strlen("Cookie: mstshash="));
out_uint8p(s, username, strlen(username));
out_uint8(s, 0x0d); /* Unknown */
out_uint8(s, 0x0a); /* Unknown */
s_mark_end(s);
tcp_send(s);
}
示例5: licence_send_authresp
/* Send an authentication response packet */
static void
licence_send_authresp(RDConnectionRef conn, uint8 * token, uint8 * crypt_hwid, uint8 * signature)
{
uint32 sec_flags = SEC_LICENCE_NEG;
uint16 length = 58;
RDStreamRef s;
s = sec_init(conn, sec_flags, length + 2);
out_uint8(s, LICENCE_TAG_AUTHRESP);
out_uint8(s, 2); /* version */
out_uint16_le(s, length);
out_uint16_le(s, 1);
out_uint16_le(s, LICENCE_TOKEN_SIZE);
out_uint8p(s, token, LICENCE_TOKEN_SIZE);
out_uint16_le(s, 1);
out_uint16_le(s, LICENCE_HWID_SIZE);
out_uint8p(s, crypt_hwid, LICENCE_HWID_SIZE);
out_uint8p(s, signature, LICENCE_SIGNATURE_SIZE);
s_mark_end(s);
sec_send(conn, s, sec_flags);
}
示例6: clipboard_request_file_size
/* ask the client to send the file size */
int APP_CC
clipboard_request_file_size(int stream_id, int lindex)
{
struct stream *s;
int size;
int rv;
log_debug("clipboard_request_file_size:");
if (g_file_request_sent_type != 0)
{
log_error("clipboard_request_file_size: warning, still waiting "
"for CB_FILECONTENTS_RESPONSE");
}
make_stream(s);
init_stream(s, 8192);
out_uint16_le(s, CB_FILECONTENTS_REQUEST); /* 8 */
out_uint16_le(s, 0);
out_uint32_le(s, 28);
out_uint32_le(s, stream_id);
out_uint32_le(s, lindex);
out_uint32_le(s, CB_FILECONTENTS_SIZE);
out_uint32_le(s, 0); /* nPositionLow */
out_uint32_le(s, 0); /* nPositionHigh */
out_uint32_le(s, 0); /* cbRequested */
out_uint32_le(s, 0); /* clipDataId */
out_uint32_le(s, 0);
s_mark_end(s);
size = (int)(s->end - s->data);
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
free_stream(s);
g_file_request_sent_type = CB_FILECONTENTS_SIZE;
return rv;
}
示例7: rdp_send_confirm_active
/* Send a confirm active PDU */
static void rdp_send_confirm_active(void) {
STREAM s;
uint32 sec_flags = g_encryption ? (RDP5_FLAG | SEC_ENCRYPT) : RDP5_FLAG;
uint16 caplen = RDP_CAPLEN_GENERAL + RDP_CAPLEN_BITMAP + RDP_CAPLEN_ORDER
+ RDP_CAPLEN_COLCACHE + RDP_CAPLEN_ACTIVATE + RDP_CAPLEN_CONTROL
+ RDP_CAPLEN_SHARE + RDP_CAPLEN_BRUSHCACHE + 0x58 + 0x08 + 0x08
+ 0x34 /* unknown caps */+ 4 /* w2k fix, sessionid */;
if (g_use_rdp5) {
caplen += RDP_CAPLEN_BMPCACHE2;
caplen += RDP_CAPLEN_NEWPOINTER;
} else {
caplen += RDP_CAPLEN_BMPCACHE;
caplen += RDP_CAPLEN_POINTER;
}
s = sec_init(sec_flags, 6 + 14 + caplen + sizeof(RDP_SOURCE));
out_uint16_le(s, 2 + 14 + caplen + sizeof(RDP_SOURCE));
out_uint16_le(s, (RDP_PDU_CONFIRM_ACTIVE | 0x10));
/* Version 1 */
out_uint16_le(s, (g_mcs_userid + 1001));
out_uint32_le(s, g_rdp_shareid);
out_uint16_le(s, 0x3ea);
/* userid */
out_uint16_le(s, sizeof(RDP_SOURCE));
out_uint16_le(s, caplen);
out_uint8p(s, RDP_SOURCE, sizeof(RDP_SOURCE));
out_uint16_le(s, 0xe);
/* num_caps */
out_uint8s(s, 2);
/* pad */
rdp_out_general_caps(s);
rdp_out_bitmap_caps(s);
rdp_out_order_caps(s);
if (g_use_rdp5) {
rdp_out_bmpcache2_caps(s);
rdp_out_newpointer_caps(s);
} else {
rdp_out_bmpcache_caps(s);
rdp_out_pointer_caps(s);
}
rdp_out_colcache_caps(s);
rdp_out_activate_caps(s);
rdp_out_control_caps(s);
rdp_out_share_caps(s);
rdp_out_brushcache_caps(s);
rdp_out_unknown_caps(s, 0x0d, 0x58, caps_0x0d); /* CAPSTYPE_INPUT */
rdp_out_unknown_caps(s, 0x0c, 0x08, caps_0x0c); /* CAPSTYPE_SOUND */
rdp_out_unknown_caps(s, 0x0e, 0x08, caps_0x0e); /* CAPSTYPE_FONT */
rdp_out_unknown_caps(s, 0x10, 0x34, caps_0x10); /* CAPSTYPE_GLYPHCACHE */
s_mark_end(s);
sec_send(s, sec_flags);
}
示例8: sound_send_server_formats
static int APP_CC
sound_send_server_formats(void)
{
struct stream *s;
int bytes;
char *size_ptr;
print_got_here();
make_stream(s);
init_stream(s, 8182);
out_uint16_le(s, SNDC_FORMATS);
size_ptr = s->p;
out_uint16_le(s, 0); /* size, set later */
out_uint32_le(s, 0); /* dwFlags */
out_uint32_le(s, 0); /* dwVolume */
out_uint32_le(s, 0); /* dwPitch */
out_uint16_le(s, 0); /* wDGramPort */
out_uint16_le(s, 1); /* wNumberOfFormats */
out_uint8(s, g_cBlockNo); /* cLastBlockConfirmed */
out_uint16_le(s, 2); /* wVersion */
out_uint8(s, 0); /* bPad */
/* sndFormats */
/*
wFormatTag 2 byte offset 0
nChannels 2 byte offset 2
nSamplesPerSec 4 byte offset 4
nAvgBytesPerSec 4 byte offset 8
nBlockAlign 2 byte offset 12
wBitsPerSample 2 byte offset 14
cbSize 2 byte offset 16
data variable offset 18
*/
/* examples
01 00 02 00 44 ac 00 00 10 b1 02 00 04 00 10 00 ....D...........
00 00
01 00 02 00 22 56 00 00 88 58 01 00 04 00 10 00 ...."V...X......
00 00
*/
out_uint16_le(s, 1); // wFormatTag - WAVE_FORMAT_PCM
out_uint16_le(s, 2); // num of channels
out_uint32_le(s, 44100); // samples per sec
out_uint32_le(s, 176400); // avg bytes per sec
out_uint16_le(s, 4); // block align
out_uint16_le(s, 16); // bits per sample
out_uint16_le(s, 0); // size
s_mark_end(s);
bytes = (int)((s->end - s->data) - 4);
size_ptr[0] = bytes;
size_ptr[1] = bytes >> 8;
bytes = (int)(s->end - s->data);
send_channel_data(g_rdpsnd_chan_id, s->data, bytes);
free_stream(s);
return 0;
}
示例9: rdpdr_send_available
static void
rdpdr_send_available(RDPCLIENT * This)
{
uint8 magic[4] = "rDAD";
uint32 driverlen, printerlen, bloblen;
int i;
STREAM s;
PRINTER *printerinfo;
s = channel_init(This, This->rdpdr.channel, announcedata_size(This));
out_uint8a(s, magic, 4);
out_uint32_le(s, This->num_devices);
for (i = 0; i < This->num_devices; i++)
{
out_uint32_le(s, This->rdpdr_device[i].device_type);
out_uint32_le(s, i); /* RDP Device ID */
/* Is it possible to use share names longer than 8 chars?
/astrand */
out_uint8p(s, This->rdpdr_device[i].name, 8);
switch (This->rdpdr_device[i].device_type)
{
case DEVICE_TYPE_PRINTER:
printerinfo = (PRINTER *) This->rdpdr_device[i].pdevice_data;
driverlen = 2 * strlen(printerinfo->driver) + 2;
printerlen = 2 * strlen(printerinfo->printer) + 2;
bloblen = printerinfo->bloblen;
out_uint32_le(s, 24 + driverlen + printerlen + bloblen); /* length of extra info */
out_uint32_le(s, printerinfo->default_printer ? 2 : 0);
out_uint8s(s, 8); /* unknown */
out_uint32_le(s, driverlen);
out_uint32_le(s, printerlen);
out_uint32_le(s, bloblen);
rdp_out_unistr(This, s, printerinfo->driver, driverlen - 2);
rdp_out_unistr(This, s, printerinfo->printer, printerlen - 2);
out_uint8a(s, printerinfo->blob, bloblen);
if (printerinfo->blob)
xfree(printerinfo->blob); /* Blob is sent twice if reconnecting */
break;
default:
out_uint32(s, 0);
}
}
#if 0
out_uint32_le(s, 0x20); /* Device type 0x20 - smart card */
out_uint32_le(s, 0);
out_uint8p(s, "SCARD", 5);
out_uint8s(s, 3);
out_uint32(s, 0);
#endif
s_mark_end(s);
channel_send(This, s, This->rdpdr.channel);
}
示例10: channel_send
void
channel_send(STREAM s, VCHANNEL * channel)
{
uint32 length, flags;
uint32 thislength, remaining;
uint8 *data;
#ifdef WITH_SCARD
scard_lock(SCARD_LOCK_CHANNEL);
#endif
/* first fragment sent in-place */
s_pop_layer(s, channel_hdr);
length = s->end - s->p - 8;
DEBUG_CHANNEL(("channel_send, length = %d\n", length));
thislength = MIN(length, CHANNEL_CHUNK_LENGTH);
/* Note: In the original clipboard implementation, this number was
1592, not 1600. However, I don't remember the reason and 1600 seems
to work so.. This applies only to *this* length, not the length of
continuation or ending packets. */
remaining = length - thislength;
flags = (remaining == 0) ? CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST : CHANNEL_FLAG_FIRST;
if (channel->flags & CHANNEL_OPTION_SHOW_PROTOCOL)
flags |= CHANNEL_FLAG_SHOW_PROTOCOL;
out_uint32_le(s, length);
out_uint32_le(s, flags);
data = s->end = s->p + thislength;
DEBUG_CHANNEL(("Sending %d bytes with FLAG_FIRST\n", thislength));
sec_send_to_channel(s, g_encryption ? SEC_ENCRYPT : 0, channel->mcs_id);
/* subsequent segments copied (otherwise would have to generate headers backwards) */
while (remaining > 0)
{
thislength = MIN(remaining, CHANNEL_CHUNK_LENGTH);
remaining -= thislength;
flags = (remaining == 0) ? CHANNEL_FLAG_LAST : 0;
if (channel->flags & CHANNEL_OPTION_SHOW_PROTOCOL)
flags |= CHANNEL_FLAG_SHOW_PROTOCOL;
DEBUG_CHANNEL(("Sending %d bytes with flags %d\n", thislength, flags));
s = sec_init(g_encryption ? SEC_ENCRYPT : 0, thislength + 8);
out_uint32_le(s, length);
out_uint32_le(s, flags);
out_uint8p(s, data, thislength);
s_mark_end(s);
sec_send_to_channel(s, g_encryption ? SEC_ENCRYPT : 0, channel->mcs_id);
data += thislength;
}
#ifdef WITH_SCARD
scard_unlock(SCARD_LOCK_CHANNEL);
#endif
}
示例11: clipboard_send_file_data
/* send a chunk of the file from server to client */
static int
clipboard_send_file_data(int streamId, int lindex,
int nPositionLow, int cbRequested)
{
struct stream *s;
int size;
int rv;
int fd;
char full_fn[256];
struct cb_file_info *cfi;
if (g_files_list == 0)
{
LLOGLN(10, ("clipboard_send_file_data: error g_files_list is nil"));
return 1;
}
cfi = (struct cb_file_info *)list_get_item(g_files_list, lindex);
if (cfi == 0)
{
LLOGLN(10, ("clipboard_send_file_data: error cfi is nil"));
return 1;
}
LLOGLN(10, ("clipboard_send_file_data: streamId %d lindex %d "
"nPositionLow %d cbRequested %d", streamId, lindex,
nPositionLow, cbRequested));
g_snprintf(full_fn, 255, "%s/%s", cfi->pathname, cfi->filename);
fd = g_file_open_ex(full_fn, 1, 0, 0, 0);
if (fd == -1)
{
LLOGLN(0, ("clipboard_send_file_data: file open [%s] failed",
full_fn));
return 1;
}
g_file_seek(fd, nPositionLow);
make_stream(s);
init_stream(s, cbRequested + 64);
size = g_file_read(fd, s->data + 12, cbRequested);
if (size < 1)
{
LLOGLN(0, ("clipboard_send_file_data: read error, want %d got %d",
cbRequested, size));
free_stream(s);
g_file_close(fd);
return 1;
}
out_uint16_le(s, CB_FILECONTENTS_RESPONSE); /* 9 */
out_uint16_le(s, CB_RESPONSE_OK); /* 1 status */
out_uint32_le(s, size + 4);
out_uint32_le(s, streamId);
s->p += size;
out_uint32_le(s, 0);
s_mark_end(s);
size = (int)(s->end - s->data);
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
free_stream(s);
g_file_close(fd);
return rv;
}
示例12: rdpusb_send_reply
static void
rdpusb_send_reply (uint8_t code, uint8_t status, uint32_t devid)
{
STREAM s = rdpusb_init_packet(5, code);
out_uint8(s, status);
out_uint32_le(s, devid);
s_mark_end(s);
rdpusb_send(s);
}
示例13: x224_send_connection_request
/* Output and send X.224 Connection Request TPDU with routing for username */
void
x224_send_connection_request(rdpIso * iso)
{
STREAM s;
int length = 11;
int cookie_length;
cookie_length = strlen(iso->cookie);
if (iso->mcs->sec->rdp->redirect_routingtoken)
/* routingToken */
length += iso->mcs->sec->rdp->redirect_routingtoken_len;
else
/* cookie */
length += 19 + cookie_length;
if (iso->nego->requested_protocols > PROTOCOL_RDP)
length += 8;
/* FIXME: Use x224_send_dst_src_class */
s = tcp_init(iso->tcp, length);
tpkt_output_header(s, length);
/* X.224 Connection Request (CR) TPDU */
out_uint8(s, length - 5); /* length indicator */
out_uint8(s, X224_TPDU_CONNECTION_REQUEST);
out_uint16_le(s, 0); /* dst_ref */
out_uint16_le(s, 0); /* src_ref */
out_uint8(s, 0); /* class */
if (iso->mcs->sec->rdp->redirect_routingtoken)
{
/* routingToken */
out_uint8p(s, iso->mcs->sec->rdp->redirect_routingtoken, iso->mcs->sec->rdp->redirect_routingtoken_len);
}
else
{
/* cookie */
out_uint8p(s, "Cookie: mstshash=", strlen("Cookie: mstshash="));
out_uint8p(s, iso->cookie, cookie_length);
out_uint8(s, 0x0D); /* CR */
out_uint8(s, 0x0A); /* LF */
}
if (iso->nego->requested_protocols > PROTOCOL_RDP)
{
out_uint8(s, TYPE_RDP_NEG_REQ); /* When using TLS, NLA, or both, RDP_NEG_DATA should be present */
out_uint8(s, 0x00); /* flags, must be set to zero */
out_uint16_le(s, 8); /* RDP_NEG_DATA length (8) */
out_uint32_le(s, iso->nego->requested_protocols); /* requestedProtocols */
}
s_mark_end(s);
tcp_send(iso->tcp, s);
}
示例14: rdpsnd_send_completion
void
rdpsnd_send_completion(uint16 tick, uint8 packet_index)
{
STREAM s;
s = rdpsnd_init_packet(RDPSND_COMPLETION, 4);
out_uint16_le(s, tick + 50);
out_uint8(s, packet_index);
out_uint8(s, 0);
s_mark_end(s);
rdpsnd_send(s);
}
示例15: rdp_send_synchronise
/* Send a synchronisation PDU */
static void rdp_send_synchronise(void) {
STREAM s;
s = rdp_init_data(4);
out_uint16_le(s, 1);
/* type */
out_uint16_le(s, 1002);
s_mark_end(s);
rdp_send_data(s, RDP_DATA_PDU_SYNCHRONISE);
}