shell.c
lib/kmalloc.h
ubixos/fork.h
string.h
net/mem.h
net/debug.h
net/def.h
net/api.h
net/stats.h
lib/kprintf.h
sys/thread.h
net/ipv4/ip.h
arch/lib.h
net/stats.h
ubixos/sched.h
net/netif.h
net/udp.h
arch/cpu.h
arch/sys_arch.h
net/tcp.h
ubixos/types.h
sys/_types.h
net/arch.h
net/ipv4/icmp.h
string.h
vfs/file.h
sys/tss.h
lib/kmalloc.h
net/lwipopts.h
src/sys/net/net/shell.c
net/def.h
ubixos/fork.h
net/mem.h
net/memp.h
vfs/vfs.h
vfs/mount.h
lib/kprintf.h
net/ipv4/ip_addr.h
net/err.h
net/api.h
ubixfs/dirCache.h
net/opt.h
sys/sysproto.h
ubixos/elf.h
sys/signal.h
net/sys.h
ubixos/tty.h
net/pbuf.h
net/debug.h
net/ipv4/inet.h
arch/cc.h
ECLOSED
-4
ESUCCESS
0
ESYNTAX
-1
ETOOFEW
-2
ETOOMANY
-3
NCONNS
10
void static void prompt (struct netconn *conn) prompt struct netconn * conn sendstr shell_main
void static void sendstr (const char *str, struct netconn *conn) sendstr const char * str struct netconn * conn NETCONN_NOCOPY netconn_write strlen prompt shell_main
void void shell_init (void) shell_init void NULL shell_thread sys_thread_new netMainThread
void static void shell_main (struct netconn *conn) shell_main struct netconn * conn buffer kprintf netbuf_copy netbuf_delete netbuf_len netconn_close netconn_recv prompt sendstr strcmp shell_thread
void static void shell_thread (void *arg) shell_thread void * arg buffer kmalloc kprintf netconn_accept netconn_bind netconn_listen netconn_new NETCONN_TCP NULL shell_main shell_init
char * char* buffer buffer 0x0 readUbixFS shell_main shell_thread sys_write udpecho_thread

    /*
    *Copyright(c)2001,SwedishInstituteofComputerScience.
    *Allrightsreserved.
    *
    *Redistributionanduseinsourceandbinaryforms,withorwithout
    *modification,arepermittedprovidedthatthefollowingconditions
    *aremet:
    *1.Redistributionsofsourcecodemustretaintheabovecopyright
    *notice,thislistofconditionsandthefollowingdisclaimer.
    *2.Redistributionsinbinaryformmustreproducetheabovecopyright
    *notice,thislistofconditionsandthefollowingdisclaimerinthe
    *documentationand/orothermaterialsprovidedwiththedistribution.
    *3.NeitherthenameoftheInstitutenorthenamesofitscontributors
    *maybeusedtoendorseorpromoteproductsderivedfromthissoftware
    *withoutspecificpriorwrittenpermission.
    *
    *THISSOFTWAREISPROVIDEDBYTHEINSTITUTEANDCONTRIBUTORS``ASIS''AND
    *ANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THE
    *IMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE
    *AREDISCLAIMED.INNOEVENTSHALLTHEINSTITUTEORCONTRIBUTORSBELIABLE
    *FORANYDIRECT,INDIRECT,INCIDENTAL,SPECIAL,EXEMPLARY,ORCONSEQUENTIAL
    *DAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODS
    *ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION)
    *HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICT
    *LIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAY
    *OUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOF
    *SUCHDAMAGE.
    *
    *ThisfileispartofthelwIPTCP/IPstack.
    *
    *Author:AdamDunkels<adam@sics.se>
    *
    *$Id: shell_8c.xml 88 2016-01-12 00:11:29Z reddawg $
    */

    #include<lib/kmalloc.h>
    #include<ubixos/fork.h>
    #include<string.h>

    #include"net/mem.h"
    #include"net/debug.h"
    #include"net/def.h"
    #include"net/api.h"
    #include"net/stats.h"

    #include"lib/kprintf.h"
    char*buffer=0x0;

    #defineESUCCESS0
    #defineESYNTAX-1
    #defineETOOFEW-2
    #defineETOOMANY-3
    #defineECLOSED-4

    #defineNCONNS10
    //UBUstaticstructnetconn*conns[NCONNS];

    staticvoidsendstr(constchar*str,structnetconn*conn){
    netconn_write(conn,(void*)str,strlen(str),NETCONN_NOCOPY);
    }

    staticvoidprompt(structnetconn*conn){
    sendstr("uBixCube:@sys>",conn);
    }

    staticvoidshell_main(structnetconn*conn){
    structnetbuf*buf=0x0;
    uInt32len;
    //UBUinti;
    //UBUcharbufr[1500];
    prompt(conn);
    while(1){
    buf=netconn_recv(conn);
    if(buf!=0x0)
    netbuf_copy(buf,buffer,1024);
    len=netbuf_len(buf);
    netbuf_delete(buf);
    buffer[len-2]='\0';
    kprintf("Buffer:[%s:%i]\n",buffer,len);
    if(!strcmp(buffer,"quit")){
    netconn_close(conn);
    break;
    }
    elseif(!strcmp(buffer,"ls")){
    sendstr("no\nfiles\nhere\n",conn);
    }
    elseif(!strcmp(buffer,"uname")){
    sendstr("UbixOSv1.0reddawg@devel.ubixos.com:/ubix.elf\n",conn);
    }
    prompt(conn);
    }
    }

    staticvoidshell_thread(void*arg){
    structnetconn*conn=0x0,*newconn=0x0;

    buffer=(char*)kmalloc(1024);

    conn=netconn_new(NETCONN_TCP);
    netconn_bind(conn,NULL,23);
    netconn_listen(conn);

    while(1){
    kprintf("1");
    newconn=netconn_accept(conn);
    kprintf("2");
    shell_main(newconn);
    kprintf("3");
    //netconn_delete(newconn);
    kprintf("4");
    }
    }

    voidshell_init(void){
    sys_thread_new(shell_thread,NULL);
    }

    /***
    END
    ***/