本文整理汇总了C++中reply函数的典型用法代码示例。如果您正苦于以下问题:C++ reply函数的具体用法?C++ reply怎么用?C++ reply使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了reply函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pass2
pass2()
{
register DINODE *dp;
struct inodesc rootdesc;
bzero((char *)&rootdesc, sizeof(struct inodesc));
rootdesc.id_type = ADDR;
rootdesc.id_func = pass2check;
rootdesc.id_number = ROOTINO;
pathp = pathname;
switch (statemap[ROOTINO]) {
case USTATE:
pfatal("ROOT INODE UNALLOCATED");
if (reply("ALLOCATE") == 0)
errexit("");
if (allocdir(ROOTINO, ROOTINO) != ROOTINO)
errexit("CANNOT ALLOCATE ROOT INODE\n");
descend(&rootdesc, ROOTINO);
break;
case DCLEAR:
pfatal("DUPS/BAD IN ROOT INODE");
if (reply("REALLOCATE")) {
freeino(ROOTINO);
if (allocdir(ROOTINO, ROOTINO) != ROOTINO)
errexit("CANNOT ALLOCATE ROOT INODE\n");
descend(&rootdesc, ROOTINO);
break;
}
if (reply("CONTINUE") == 0)
errexit("");
statemap[ROOTINO] = DSTATE;
descend(&rootdesc, ROOTINO);
break;
case FSTATE:
case FCLEAR:
pfatal("ROOT INODE NOT DIRECTORY");
if (reply("REALLOCATE")) {
freeino(ROOTINO);
if (allocdir(ROOTINO, ROOTINO) != ROOTINO)
errexit("CANNOT ALLOCATE ROOT INODE\n");
descend(&rootdesc, ROOTINO);
break;
}
if (reply("FIX") == 0)
errexit("");
dp = ginode(ROOTINO);
dp->di_mode &= ~IFMT;
dp->di_mode |= IFDIR;
inodirty();
statemap[ROOTINO] = DSTATE;
/* fall into ... */
case DSTATE:
descend(&rootdesc, ROOTINO);
break;
default:
errexit("BAD STATE %d FOR ROOT INODE", statemap[ROOTINO]);
}
}
示例2: reply
virtual void reply( Message& received, Message& response ) {
reply( received , response , received.data->id );
}
示例3: reply
bool CheckServerJob::finished()
{
if (reply()->request().url().scheme() == QLatin1String("https")
&& reply()->sslConfiguration().sessionTicket().isEmpty()
&& reply()->error() == QNetworkReply::NoError) {
qCWarning(lcCheckServerJob) << "No SSL session identifier / session ticket is used, this might impact sync performance negatively.";
}
mergeSslConfigurationForSslButton(reply()->sslConfiguration(), account());
// The server installs to /owncloud. Let's try that if the file wasn't found
// at the original location
if ((reply()->error() == QNetworkReply::ContentNotFoundError) && (!_subdirFallback)) {
_subdirFallback = true;
setPath(QLatin1String(owncloudDirC) + QLatin1String(statusphpC));
start();
qCInfo(lcCheckServerJob) << "Retrying with" << reply()->url();
return false;
}
QByteArray body = reply()->peek(4 * 1024);
int httpStatus = reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
if (body.isEmpty() || httpStatus != 200) {
qCWarning(lcCheckServerJob) << "error: status.php replied " << httpStatus << body;
emit instanceNotFound(reply());
} else {
QJsonParseError error;
auto status = QJsonDocument::fromJson(body, &error);
// empty or invalid response
if (error.error != QJsonParseError::NoError || status.isNull()) {
qCWarning(lcCheckServerJob) << "status.php from server is not valid JSON!" << body << reply()->request().url() << error.errorString();
}
qCInfo(lcCheckServerJob) << "status.php returns: " << status << " " << reply()->error() << " Reply: " << reply();
if (status.object().contains("installed")) {
emit instanceFound(_serverUrl, status.object());
} else {
qCWarning(lcCheckServerJob) << "No proper answer on " << reply()->url();
emit instanceNotFound(reply());
}
}
return true;
}
示例4: finishedSignal
bool SimpleNetworkJob::finished()
{
emit finishedSignal(reply());
return true;
}
示例5: pass2
pass2()
{
register struct dinode *dp;
register struct inoinfo **inpp, *inp;
struct inoinfo **inpend;
struct inodesc curino;
struct dinode dino;
char pathbuf[MAXPATHLEN + 1];
switch (statemap[ROOTINO]) {
case USTATE:
pfatal("ROOT INODE UNALLOCATED");
if (reply("ALLOCATE") == 0)
errexit("");
if (allocdir(ROOTINO, ROOTINO, 0755) != ROOTINO)
errexit("CANNOT ALLOCATE ROOT INODE\n");
break;
case DCLEAR:
pfatal("DUPS/BAD IN ROOT INODE");
if (reply("REALLOCATE")) {
freeino(ROOTINO);
if (allocdir(ROOTINO, ROOTINO, 0755) != ROOTINO)
errexit("CANNOT ALLOCATE ROOT INODE\n");
break;
}
if (reply("CONTINUE") == 0)
errexit("");
break;
case FSTATE:
case FCLEAR:
pfatal("ROOT INODE NOT DIRECTORY");
if (reply("REALLOCATE")) {
freeino(ROOTINO);
if (allocdir(ROOTINO, ROOTINO, 0755) != ROOTINO)
errexit("CANNOT ALLOCATE ROOT INODE\n");
break;
}
if (reply("FIX") == 0)
errexit("");
dp = ginode(ROOTINO);
dp->di_mode &= ~IFMT;
dp->di_mode |= IFDIR;
inodirty();
break;
case DSTATE:
break;
default:
errexit("BAD STATE %d FOR ROOT INODE", statemap[ROOTINO]);
}
statemap[ROOTINO] = DFOUND;
/*
* Sort the directory list into disk block order.
*/
qsort((char *)inpsort, (size_t)inplast, sizeof *inpsort, blksort);
/*
* Check the integrity of each directory.
*/
bzero((char *)&curino, sizeof(struct inodesc));
curino.id_type = DATA;
curino.id_func = pass2check;
dino.di_mode = IFDIR;
dp = &dino;
inpend = &inpsort[inplast];
for (inpp = inpsort; inpp < inpend; inpp++) {
inp = *inpp;
if (inp->i_isize == 0)
continue;
if (inp->i_isize < MINDIRSIZE) {
direrror(inp->i_number, "DIRECTORY TOO SHORT");
inp->i_isize = roundup(MINDIRSIZE, DIRBLKSIZ);
if (reply("FIX") == 1) {
dp = ginode(inp->i_number);
dp->di_size = inp->i_isize;
inodirty();
dp = &dino;
}
} else if ((inp->i_isize & (DIRBLKSIZ - 1)) != 0) {
getpathname(pathbuf, inp->i_number, inp->i_number);
pwarn("DIRECTORY %s: LENGTH %d NOT MULTIPLE OF %d",
pathbuf, inp->i_isize, DIRBLKSIZ);
if (preen)
printf(" (ADJUSTED)\n");
inp->i_isize = roundup(inp->i_isize, DIRBLKSIZ);
if (preen || reply("ADJUST") == 1) {
dp = ginode(inp->i_number);
dp->di_size = roundup(inp->i_isize, DIRBLKSIZ);
inodirty();
dp = &dino;
}
}
dp->di_size = inp->i_isize;
bcopy((char *)&inp->i_blks[0], (char *)&dp->di_db[0],
(size_t)inp->i_numblks);
curino.id_number = inp->i_number;
curino.id_parent = inp->i_parent;
//.........这里部分代码省略.........
示例6: mergeSslConfigurationForSslButton
void CheckServerJob::encryptedSlot()
{
mergeSslConfigurationForSslButton(reply()->sslConfiguration(), account());
}
示例7: sender
void
sender(String *path)
{
String *s;
static char *lastsender;
if(rejectcheck())
return;
if (authenticate && !authenticated) {
rejectcount++;
reply("530 5.7.0 Authentication required\r\n");
return;
}
if(him == 0 || *him == 0){
rejectcount++;
reply("503 Start by saying HELO, please.\r\n", s_to_c(path));
return;
}
/* don't add the domain onto black holes or we will loop */
if(strchr(s_to_c(path), '!') == 0 && strcmp(s_to_c(path), "/dev/null") != 0){
s = s_new();
s_append(s, him);
s_append(s, "!");
s_append(s, s_to_c(path));
s_terminate(s);
s_free(path);
path = s;
}
if(shellchars(s_to_c(path))){
rejectcount++;
reply("501 5.1.3 Bad character in sender address %s.\r\n",
s_to_c(path));
return;
}
/*
* if the last sender address resulted in a rejection because the sending
* domain didn't exist and this sender has the same domain, reject
* immediately.
*/
if(lastsender){
if (strncmp(lastsender, s_to_c(path), strlen(lastsender)) == 0){
filterstate = REFUSED;
rejectcount++;
reply("554 5.1.8 Sender domain must exist: %s\r\n",
s_to_c(path));
return;
}
free(lastsender); /* different sender domain */
lastsender = 0;
}
/*
* see if this ip address, domain name, user name or account is blocked
*/
logged = 0;
filterstate = blocked(path);
/*
* permanently reject what we can before trying smtp ping, which
* often leads to merely temporary rejections.
*/
switch (filterstate){
case DENIED:
syslog(0, "smtpd", "Denied %s (%s/%s)",
s_to_c(path), him, nci->rsys);
rejectcount++;
logged++;
reply("554-5.7.1 We don't accept mail from %s.\r\n",
s_to_c(path));
reply("554 5.7.1 Contact [email protected]%s for more information.\r\n",
dom);
return;
case REFUSED:
syslog(0, "smtpd", "Refused %s (%s/%s)",
s_to_c(path), him, nci->rsys);
rejectcount++;
logged++;
reply("554 5.7.1 Sender domain must exist: %s\r\n",
s_to_c(path));
return;
}
listadd(&senders, path);
reply("250 2.0.0 sender is %s\r\n", s_to_c(path));
}
示例8: startcmd
String*
startcmd(void)
{
int n;
char *filename;
char **av;
Link *l;
String *cmd;
/*
* ignore the filterstate if the all the receivers prefer it.
*/
filterstate = optoutall(filterstate);
switch (filterstate){
case BLOCKED:
case DELAY:
rejectcount++;
logmsg("Blocked");
filename = dumpfile(s_to_c(senders.last->p));
cmd = s_new();
s_append(cmd, "cat > ");
s_append(cmd, filename);
pp = proc_start(s_to_c(cmd), instream(), 0, outstream(), 0, 0);
break;
case DIALUP:
logmsg("Dialup");
rejectcount++;
reply("554 5.7.1 We don't accept mail from dial-up ports.\r\n");
/*
* we could exit here, because we're never going to accept mail
* from this ip address, but it's unclear that RFC821 allows
* that. Instead we set the hardreject flag and go stupid.
*/
hardreject = 1;
return 0;
case DENIED:
logmsg("Denied");
rejectcount++;
reply("554-5.7.1 We don't accept mail from %s.\r\n",
s_to_c(senders.last->p));
reply("554 5.7.1 Contact [email protected]%s for more information.\r\n",
dom);
return 0;
case REFUSED:
logmsg("Refused");
rejectcount++;
reply("554 5.7.1 Sender domain must exist: %s\r\n",
s_to_c(senders.last->p));
return 0;
default:
case NONE:
logmsg("Confused");
rejectcount++;
reply("554-5.7.0 We have had an internal mailer error "
"classifying your message.\r\n");
reply("554-5.7.0 Filterstate is %d\r\n", filterstate);
reply("554 5.7.0 Contact [email protected]%s for more information.\r\n",
dom);
return 0;
case ACCEPT:
/*
* now that all other filters have been passed,
* do grey-list processing.
*/
if(gflag)
vfysenderhostok();
/* fall through */
case TRUSTED:
/*
* set up mail command
*/
cmd = s_clone(mailer);
n = 3;
for(l = rcvers.first; l; l = l->next)
n++;
av = malloc(n * sizeof(char*));
if(av == nil){
reply("450 4.3.2 We're busy right now, try later\r\n");
s_free(cmd);
return 0;
}
n = 0;
av[n++] = s_to_c(cmd);
av[n++] = "-r";
for(l = rcvers.first; l; l = l->next)
av[n++] = s_to_c(l->p);
av[n] = 0;
/*
* start mail process
*/
pp = noshell_proc_start(av, instream(), outstream(),
outstream(), 0, 0);
free(av);
break;
}
if(pp == 0) {
reply("450 4.3.2 We're busy right now, try later\r\n");
//.........这里部分代码省略.........
示例9: sayhi
void
sayhi(void)
{
reply("220 %s ESMTP\r\n", dom);
}
示例10: hello
void
hello(String *himp, int extended)
{
char **mynames;
char *ldot, *rdot;
him = s_to_c(himp);
syslog(0, "smtpd", "%s from %s as %s", extended? "ehlo": "helo",
nci->rsys, him);
if(rejectcheck())
return;
if (strchr(him, '.') && nci && !trusted && fflag &&
strcmp(nci->rsys, nci->lsys) != 0){
/*
* We don't care if he lies about who he is, but it is
* not okay to pretend to be us. Many viruses do this,
* just parroting back what we say in the greeting.
*/
if(strcmp(him, dom) == 0)
goto Liarliar;
for(mynames = sysnames_read(); mynames && *mynames; mynames++){
if(cistrcmp(*mynames, him) == 0){
Liarliar:
syslog(0, "smtpd",
"Hung up on %s; claimed to be %s",
nci->rsys, him);
if(Dflag)
sleep(delaysecs()*1000);
reply("554 5.7.0 Liar!\r\n");
exits("client pretended to be us");
return;
}
}
}
/*
* it is unacceptable to claim any string that doesn't look like
* a domain name (e.g., has at least one dot in it), but
* Microsoft mail client software gets this wrong, so let trusted
* (local) clients omit the dot.
*/
rdot = strrchr(him, '.');
if (rdot && rdot[1] == '\0') {
*rdot = '\0'; /* clobber trailing dot */
rdot = strrchr(him, '.'); /* try again */
}
if (!trusted && rdot == nil)
goto Liarliar;
/*
* Reject obviously bogus domains and those reserved by RFC 2606.
*/
if (rdot == nil)
rdot = him;
else
rdot++;
if (!trusted && (cistrcmp(rdot, "localdomain") == 0 ||
cistrcmp(rdot, "localhost") == 0 ||
cistrcmp(rdot, "example") == 0 ||
cistrcmp(rdot, "invalid") == 0 ||
cistrcmp(rdot, "test") == 0))
goto Liarliar; /* bad top-level domain */
/* check second-level RFC 2606 domains: example\.(com|net|org) */
if (rdot != him)
*--rdot = '\0';
ldot = strrchr(him, '.');
if (rdot != him)
*rdot = '.';
if (ldot == nil)
ldot = him;
else
ldot++;
if (cistrcmp(ldot, "example.com") == 0 ||
cistrcmp(ldot, "example.net") == 0 ||
cistrcmp(ldot, "example.org") == 0)
goto Liarliar;
/*
* similarly, if the claimed domain is not an address-literal,
* require at least one letter, which there will be in
* at least the last component (e.g., .com, .net) if it's real.
* this rejects non-address-literal IP addresses,
* among other bogosities.
*/
if (!trusted && him[0] != '[') {
char *p;
for (p = him; *p != '\0'; p++)
if (isascii(*p) && isalpha(*p))
break;
if (*p == '\0')
goto Liarliar;
}
if(strchr(him, '.') == 0 && nci != nil && strchr(nci->rsys, '.') != nil)
him = nci->rsys;
if(Dflag)
sleep(delaysecs()*1000);
reply("250%c%s you are %s\r\n", extended ? '-' : ' ', dom, him);
if (extended) {
//.........这里部分代码省略.........
示例11: auth
void
auth(String *mech, String *resp)
{
char *user, *pass, *scratch = nil;
AuthInfo *ai = nil;
Chalstate *chs = nil;
String *s_resp1_64 = nil, *s_resp2_64 = nil, *s_resp1 = nil;
String *s_resp2 = nil;
if (rejectcheck())
goto bomb_out;
syslog(0, "smtpd", "auth(%s, %s) from %s", s_to_c(mech),
"(protected)", him);
if (authenticated) {
bad_sequence:
rejectcount++;
reply("503 5.5.2 Bad sequence of commands\r\n");
goto bomb_out;
}
if (cistrcmp(s_to_c(mech), "plain") == 0) {
if (!passwordinclear) {
rejectcount++;
reply("538 5.7.1 Encryption required for requested "
"authentication mechanism\r\n");
goto bomb_out;
}
s_resp1_64 = resp;
if (s_resp1_64 == nil) {
reply("334 \r\n");
s_resp1_64 = s_new();
if (getcrnl(s_resp1_64, &bin) <= 0)
goto bad_sequence;
}
s_resp1 = s_dec64(s_resp1_64);
if (s_resp1 == nil) {
rejectcount++;
reply("501 5.5.4 Cannot decode base64\r\n");
goto bomb_out;
}
memset(s_to_c(s_resp1_64), 'X', s_len(s_resp1_64));
user = s_to_c(s_resp1) + strlen(s_to_c(s_resp1)) + 1;
pass = user + strlen(user) + 1;
ai = auth_userpasswd(user, pass);
authenticated = ai != nil;
memset(pass, 'X', strlen(pass));
goto windup;
}
else if (cistrcmp(s_to_c(mech), "login") == 0) {
if (!passwordinclear) {
rejectcount++;
reply("538 5.7.1 Encryption required for requested "
"authentication mechanism\r\n");
goto bomb_out;
}
if (resp == nil) {
reply("334 VXNlcm5hbWU6\r\n");
s_resp1_64 = s_new();
if (getcrnl(s_resp1_64, &bin) <= 0)
goto bad_sequence;
}
reply("334 UGFzc3dvcmQ6\r\n");
s_resp2_64 = s_new();
if (getcrnl(s_resp2_64, &bin) <= 0)
goto bad_sequence;
s_resp1 = s_dec64(s_resp1_64);
s_resp2 = s_dec64(s_resp2_64);
memset(s_to_c(s_resp2_64), 'X', s_len(s_resp2_64));
if (s_resp1 == nil || s_resp2 == nil) {
rejectcount++;
reply("501 5.5.4 Cannot decode base64\r\n");
goto bomb_out;
}
ai = auth_userpasswd(s_to_c(s_resp1), s_to_c(s_resp2));
authenticated = ai != nil;
memset(s_to_c(s_resp2), 'X', s_len(s_resp2));
windup:
if (authenticated) {
/* if you authenticated, we trust you despite your IP */
trusted = 1;
reply("235 2.0.0 Authentication successful\r\n");
} else {
rejectcount++;
reply("535 5.7.1 Authentication failed\r\n");
syslog(0, "smtpd", "authentication failed: %r");
}
goto bomb_out;
}
else if (cistrcmp(s_to_c(mech), "cram-md5") == 0) {
int chal64n;
char *resp, *t;
chs = auth_challenge("proto=cram role=server");
if (chs == nil) {
rejectcount++;
reply("501 5.7.5 Couldn't get CRAM-MD5 challenge\r\n");
goto bomb_out;
}
scratch = malloc(chs->nchal * 2 + 1);
//.........这里部分代码省略.........
示例12: data
void
data(void)
{
int status, nbytes;
char *cp, *ep;
char errx[ERRMAX];
Link *l;
String *cmd, *err;
if(rejectcheck())
return;
if(senders.last == 0){
reply("503 2.5.2 Data without MAIL FROM:\r\n");
rejectcount++;
return;
}
if(rcvers.last == 0){
reply("503 2.5.2 Data without RCPT TO:\r\n");
rejectcount++;
return;
}
if(!trusted && sendermxcheck()){
rerrstr(errx, sizeof errx);
if(strncmp(errx, "rejected:", 9) == 0)
reply("554 5.7.1 %s\r\n", errx);
else
reply("450 4.7.0 %s\r\n", errx);
for(l=rcvers.first; l; l=l->next)
syslog(0, "smtpd", "[%s/%s] %s -> %s sendercheck: %s",
him, nci->rsys, s_to_c(senders.first->p),
s_to_c(l->p), errx);
rejectcount++;
return;
}
cmd = startcmd();
if(cmd == 0)
return;
reply("354 Input message; end with <CRLF>.<CRLF>\r\n");
if(debug){
seek(2, 0, 2);
stamp();
fprint(2, "# sent 354; accepting DATA %s\n", thedate());
}
/*
* allow 145 more minutes to move the data
*/
alarm(145*60*1000);
status = pipemsg(&nbytes);
/*
* read any error messages
*/
err = s_new();
if (debug) {
stamp();
fprint(2, "waiting for upas/send to close stderr\n");
}
while(s_read_line(pp->std[2]->fp, err))
;
alarm(0);
atnotify(catchalarm, 0);
if (debug) {
stamp();
fprint(2, "waiting for upas/send to exit\n");
}
status |= proc_wait(pp);
if(debug){
seek(2, 0, 2);
stamp();
fprint(2, "# %d upas/send status %#ux at %s\n",
getpid(), status, thedate());
if(*s_to_c(err))
fprint(2, "# %d error %s\n", getpid(), s_to_c(err));
}
/*
* if process terminated abnormally, send back error message
*/
if(status){
int code;
char *ecode;
if(strstr(s_to_c(err), "mail refused")){
syslog(0, "smtpd", "++[%s/%s] %s %s refused: %s",
him, nci->rsys, s_to_c(senders.first->p),
s_to_c(cmd), firstline(s_to_c(err)));
code = 554;
ecode = "5.0.0";
} else {
syslog(0, "smtpd", "++[%s/%s] %s %s %s%s%sreturned %#q %s",
him, nci->rsys,
s_to_c(senders.first->p), s_to_c(cmd),
piperror? "error during pipemsg: ": "",
//.........这里部分代码省略.........
示例13: linkup
int
linkup(ino_t orphan, ino_t parentdir)
{
union lfs_dinode *dp;
int lostdir;
ino_t oldlfdir;
struct inodesc idesc;
char tempname[BUFSIZ];
struct uvnode *vp;
memset(&idesc, 0, sizeof(struct inodesc));
vp = vget(fs, orphan);
dp = VTOD(vp);
lostdir = (lfs_dino_getmode(fs, dp) & LFS_IFMT) == LFS_IFDIR;
pwarn("UNREF %s ", lostdir ? "DIR" : "FILE");
pinode(orphan);
if (preen && lfs_dino_getsize(fs, dp) == 0)
return (0);
if (preen)
printf(" (RECONNECTED)\n");
else if (reply("RECONNECT") == 0)
return (0);
if (lfdir == 0) {
dp = ginode(ULFS_ROOTINO);
idesc.id_name = lfname;
idesc.id_type = DATA;
idesc.id_func = findino;
idesc.id_number = ULFS_ROOTINO;
if ((ckinode(dp, &idesc) & FOUND) != 0) {
lfdir = idesc.id_parent;
} else {
pwarn("NO lost+found DIRECTORY");
if (preen || reply("CREATE")) {
lfdir = allocdir(ULFS_ROOTINO, (ino_t) 0, lfmode);
if (lfdir != 0) {
if (makeentry(ULFS_ROOTINO, lfdir, lfname) != 0) {
if (preen)
printf(" (CREATED)\n");
} else {
freedir(lfdir, ULFS_ROOTINO);
lfdir = 0;
if (preen)
printf("\n");
}
}
}
}
if (lfdir == 0) {
pfatal("SORRY. CANNOT CREATE lost+found DIRECTORY");
printf("\n\n");
return (0);
}
}
vp = vget(fs, lfdir);
dp = VTOD(vp);
if ((lfs_dino_getmode(fs, dp) & LFS_IFMT) != LFS_IFDIR) {
pfatal("lost+found IS NOT A DIRECTORY");
if (reply("REALLOCATE") == 0)
return (0);
oldlfdir = lfdir;
if ((lfdir = allocdir(ULFS_ROOTINO, (ino_t) 0, lfmode)) == 0) {
pfatal("SORRY. CANNOT CREATE lost+found DIRECTORY\n\n");
return (0);
}
if ((changeino(ULFS_ROOTINO, lfname, lfdir) & ALTERED) == 0) {
pfatal("SORRY. CANNOT CREATE lost+found DIRECTORY\n\n");
return (0);
}
inodirty(VTOI(vp));
idesc.id_type = ADDR;
idesc.id_func = pass4check;
idesc.id_number = oldlfdir;
adjust(&idesc, lncntp[oldlfdir] + 1);
lncntp[oldlfdir] = 0;
vp = vget(fs, lfdir);
dp = VTOD(vp);
}
if (statemap[lfdir] != DFOUND) {
pfatal("SORRY. NO lost+found DIRECTORY\n\n");
return (0);
}
(void) lftempname(tempname, orphan);
if (makeentry(lfdir, orphan, tempname) == 0) {
pfatal("SORRY. NO SPACE IN lost+found DIRECTORY");
printf("\n\n");
return (0);
}
lncntp[orphan]--;
if (lostdir) {
if ((changeino(orphan, "..", lfdir) & ALTERED) == 0 &&
parentdir != (ino_t) - 1)
(void) makeentry(orphan, lfdir, "..");
vp = vget(fs, lfdir);
lfs_dino_setnlink(fs, VTOI(vp)->i_din,
lfs_dino_getnlink(fs, VTOI(vp)->i_din) + 1);
inodirty(VTOI(vp));
lncntp[lfdir]++;
pwarn("DIR I=%llu CONNECTED. ", (unsigned long long)orphan);
if (parentdir != (ino_t) - 1)
printf("PARENT WAS I=%llu\n",
//.........这里部分代码省略.........
示例14: switch
/*! \brief Message handling function for all messages sent to the app_server
\param code ID of the message sent
\param buffer Attachment buffer for the message.
*/
void
AppServer::_DispatchMessage(int32 code, BPrivate::LinkReceiver& msg)
{
switch (code) {
case AS_GET_DESKTOP:
{
Desktop* desktop = NULL;
port_id replyPort;
msg.Read<port_id>(&replyPort);
int32 userID;
msg.Read<int32>(&userID);
char* targetScreen = NULL;
msg.ReadString(&targetScreen);
if (targetScreen != NULL && strlen(targetScreen) == 0) {
free(targetScreen);
targetScreen = NULL;
}
int32 version;
if (msg.Read<int32>(&version) < B_OK
|| version != AS_PROTOCOL_VERSION) {
syslog(LOG_ERR, "Application for user %" B_PRId32 " with port "
"%" B_PRId32 " does not support the current server "
"protocol.\n", userID, replyPort);
} else {
desktop = _FindDesktop(userID, targetScreen);
if (desktop == NULL) {
// we need to create a new desktop object for this user
// TODO: test if the user exists on the system
// TODO: maybe have a separate AS_START_DESKTOP_SESSION for
// authorizing the user
desktop = _CreateDesktop(userID, targetScreen);
}
}
free(targetScreen);
BPrivate::LinkSender reply(replyPort);
if (desktop != NULL) {
reply.StartMessage(B_OK);
reply.Attach<port_id>(desktop->MessagePort());
} else
reply.StartMessage(B_ERROR);
reply.Flush();
break;
}
#if TEST_MODE
case B_QUIT_REQUESTED:
{
// We've been asked to quit, so (for now) broadcast to all
// desktops to quit. This situation will occur only when the server
// is compiled as a regular Be application.
fQuitting = true;
while (fDesktops.CountItems() > 0) {
Desktop *desktop = fDesktops.RemoveItemAt(0);
thread_id thread = desktop->Thread();
desktop->PostMessage(B_QUIT_REQUESTED);
// we just wait for the desktop to kill itself
status_t status;
wait_for_thread(thread, &status);
}
delete this;
// we are now clear to exit
exit(0);
break;
}
#endif
default:
STRACE(("Server::MainLoop received unexpected code %" B_PRId32 " "
"(offset %" B_PRId32 ")\n", code, code - SERVER_TRUE));
break;
}
}
示例15: switch
void
NotificationView::MessageReceived(BMessage* msg)
{
switch (msg->what) {
case B_GET_PROPERTY:
{
BMessage specifier;
const char* property;
BMessage reply(B_REPLY);
bool msgOkay = true;
if (msg->FindMessage("specifiers", 0, &specifier) != B_OK)
msgOkay = false;
if (specifier.FindString("property", &property) != B_OK)
msgOkay = false;
if (msgOkay) {
if (strcmp(property, "type") == 0)
reply.AddInt32("result", fType);
if (strcmp(property, "app") == 0)
reply.AddString("result", fApp);
if (strcmp(property, "title") == 0)
reply.AddString("result", fTitle);
if (strcmp(property, "content") == 0)
reply.AddString("result", fText);
if (strcmp(property, "progress") == 0)
reply.AddFloat("result", fProgress);
if ((strcmp(property, "icon") == 0) && fBitmap) {
BMessage archive;
if (fBitmap->Archive(&archive) == B_OK)
reply.AddMessage("result", &archive);
}
reply.AddInt32("error", B_OK);
} else {
reply.what = B_MESSAGE_NOT_UNDERSTOOD;
reply.AddInt32("error", B_ERROR);
}
msg->SendReply(&reply);
break;
}
case B_SET_PROPERTY:
{
BMessage specifier;
const char* property;
BMessage reply(B_REPLY);
bool msgOkay = true;
if (msg->FindMessage("specifiers", 0, &specifier) != B_OK)
msgOkay = false;
if (specifier.FindString("property", &property) != B_OK)
msgOkay = false;
if (msgOkay) {
if (strcmp(property, "app") == 0)
msg->FindString("data", &fApp);
if (strcmp(property, "title") == 0)
msg->FindString("data", &fTitle);
if (strcmp(property, "content") == 0)
msg->FindString("data", &fText);
if (strcmp(property, "icon") == 0) {
BMessage archive;
if (msg->FindMessage("data", &archive) == B_OK) {
delete fBitmap;
fBitmap = new BBitmap(&archive);
}
}
SetText(Application(), Title(), Text());
Invalidate();
reply.AddInt32("error", B_OK);
} else {
reply.what = B_MESSAGE_NOT_UNDERSTOOD;
reply.AddInt32("error", B_ERROR);
}
msg->SendReply(&reply);
break;
}
case kRemoveView:
{
BMessage remove(kRemoveView);
remove.AddPointer("view", this);
BMessenger msgr(Window());
msgr.SendMessage( &remove );
break;
}
default:
BView::MessageReceived(msg);
}
//.........这里部分代码省略.........